Capacitor could not find the web assets directory

See original GitHub issue

Description:

Trying to run on iOS on a blank project but getting the below error. From the docs as I understand it correctly I just need to run that command without any previous commands.

Steps to Reproduce:

❯ ionic start

Pick a framework! 😁

Please select the JavaScript framework to use for your new app. To bypass this prompt next time, supply a value for the
--type option.

? Framework: Angular

Every great app needs a name! 😍

Please enter the full name of your app. You can change this at any time. To bypass this prompt next time, supply name,
the first argument to ionic start.

? Project name: test

Let's pick the perfect starter template! 💪

Starter templates are ready-to-go Ionic apps that come packed with everything you need to build your app. To bypass this
prompt next time, supply template, the second argument to ionic start.

? Starter template: blank
✔ Preparing directory ./test - done!
✔ Downloading and extracting blank starter - done!
? Integrate your new app with Capacitor to target native iOS and Android? Yes

Output:

❯ ionic capacitor run ios -l --verbose
  ionic:lib Terminal info: { ci: false, shell: '/bin/zsh', tty: true, windows: false } +0ms
  ionic:lib CLI global options: { _: [ 'capacitor', 'run', 'ios' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, l: true, project: null, '--': [] } +4ms
  ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
  ionic:lib:project Project details: { configPath: '/Users/marvinheilemann/Downloads/test/ionic.config.json', errors: [], context: 'app', type: 'angular' } +0ms
  ionic Context: { binPath: '/Users/marvinheilemann/.nvm/versions/node/v12.18.0/lib/node_modules/@ionic/cli/bin/ionic', libPath: '/Users/marvinheilemann/.nvm/versions/node/v12.18.0/lib/node_modules/@ionic/cli', execPath: '/Users/marvinheilemann/Downloads/test', version: '6.11.0' } +0ms
> capacitor add ios
[error] Capacitor could not find the web assets directory "/Users/marvinheilemann/Downloads/test/www".
    Please create it and make sure it has an index.html file. You can change
    the path of this directory in capacitor.config.json (webDir option).
    You may need to compile the web assets for your app (typically 'npm run build').
    More info: https://capacitorjs.com/docs/basics/building-your-app
[ERROR] An error occurred while running subprocess capacitor.

        capacitor add ios exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
  ionic:utils-process onBeforeExit handler: running 1 functions +1ms
  ionic:utils-process processExit: exiting (exit code: 1) +61ms

My ionic info:

Ionic:

   Ionic CLI                     : 6.11.0 (/Users/marvinheilemann/.nvm/versions/node/v12.18.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.1
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.0

Capacitor:

   Capacitor CLI   : 2.4.0
   @capacitor/core : 2.4.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.18.0 (/Users/marvinheilemann/.nvm/versions/node/v12.18.0/bin/node)
   npm    : 6.14.7
   OS     : macOS Catalina

Other Information:

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

71reactions
bmk15897commented, Oct 5, 2020

Simple “ionic build” worked for me!

11reactions
imhoffdcommented, Aug 12, 2020

@muuvmuuv Can you link to the docs you’re referencing?

The workaround is to do what it says:

You may need to compile the web assets for your app (typically ‘npm run build’).

But it’s not the best user experience. It’s certainly something I’d like to address for Capacitor 3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

problem getting my ionic/capacitor app to build - Reddit
I try to do a ionic capacitor build android and I get this error: Could not find the web assets directory: ./www.
Read more >
Ionic Forum - Ionic Framework
I try to do a ionic capacitor build android and I get this error: Could not find the web assets directory: ./www.
Read more >
Can't find path to file in assets folder in Capacitor app
I can play sounds from the web via urls, but not from the app's own fixed assets directory, it just says file not...
Read more >
Capacitor Configuration | Capacitor Documentation
* The directory of your compiled web assets. * * This directory should contain the final `index.html` of your app.
Read more >
ionic studio capacitor
Capacitor could not find the web assets directory "/Users/abhijeetrathore/ionic-4-music/www". Check your capacitor.config.json file. Make sure the webDir field ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found