Hi Guys,
When trying to install from scratch i get the following error:
[error] Could not find the web platform directory. Make sure /Users/jarratt/Development/ionic/my-app/public exists.
node -v v9.5.0
npm -v 5.6.0
This was from a clean install runnin npx capacitor init below is the full output
⚡️ Initializing Capacitor project in /Users/jarratt/Development/ionic/my-app ⚡️
? Is this a new app? Answer 'n' if adding Capacitor to an existing project y
✔ Creating capacitor.config.json in 1.32ms
✔ Downloading and installing seed project in 2.41s
✔ Installing dependencies for seed project (npm install) in 1.80s
✔ Installing Capacitor dependencies (npm install --save @capacitor/core@latest @capacitor/cli@latest) in 11.33s
✔ Adding native xcode project in: /Users/jarratt/Development/ionic/my-app/ios in 60.87ms
✔ Adding native android project in: /Users/jarratt/Development/ionic/my-app/android in 24.64ms
✔ Adding native platforms in 92.23ms
iOS Note: you should periodically run "pod repo update" to make sure your local Pod repo is up to date and can find new Pod releases.
? Run "pod repo update" to make sure you have the latest Pods available before updating (takes a few minutes)? y
✔ Running pod repo update to update CocoaPods in 31.30s
✔ Fetching plugins in 2.64ms
[info] found 18 native modules
[core] Browser
[core] Camera
[core] Clipboard
[core] Console
[core] Device
[core] Filesystem
[core] Geolocation
[core] Haptics
[core] LocalNotifications
[core] Modals
[core] Motion
[core] Network
[core] PushNotifications
[core] Share
[core] SplashScreen
[core] StatusBar
[core] Storage
[core] Toast
✔ Updating iOS native dependencies in 4.90s
✔ Copying web assets from public to ios/App/public in 3.69ms
✔ Fetching plugins in 1.74ms
⠋ Updating android
✔ Updating android in 110.70μp
⠋ Copying web assets from public to android/app/src/main/assets/public(node:99435) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/Users/jarratt/Development/ionic/my-app/android/app/src/main/assets/public/cordova_plugins.js'
(node:99435) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:99435) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✔ Copying web assets from public to android/app/src/main/assets/public in 3.53ms
[error] Could not find the web platform directory. Make sure /Users/jarratt/Development/ionic/my-app/public exists.
Here is a list of the files inside the public folder.
~/Development/ionic/my-app$ ll public/
total 16
drwxr-xr-x 3 jarratt staff 96B Feb 6 14:53 css
-rw-r--r-- 1 jarratt staff 1.2K Feb 6 14:53 index.html
drwxr-xr-x 3 jarratt staff 96B Feb 6 14:53 js
-rw-r--r-- 1 jarratt staff 263B Feb 6 14:53 manifest.json
Interesting, looks like the copy operation for cordova plugins breaks. This might be fixed with a PR I need to merge here soon from @jcesarmobile
I think that's not the problem.
@ratt in which folder do you have your app code?
When you init the project it ask for the folder, default value is "public", but Ionic apps have it in "src", or Cordova apps in "www". You probably used the default value but public folder doesn't exist in your project.
So update the webDir value in the capacitor.config.json file to look like this:
{
"webDir": "src"
}
Well src is usually reserved for code that will need to be built, and the outputted to a web dir like www or public
It seems the android task above fails which causes some folder to not be created
Also this is on a fresh project so those folders are guaranteed to exist unless something broke, like it did above. Let me publish your recent PRs and we'll see
Closing because I think this is fixed w/ later android cordova PRs
Hello! I try build app with capacitor but not work, show me the same error with:
ionic cap sync android



Please, can you report a new issue?
In your new issue, can you tell us if you have an index.html in your www folder?
Also, can you check if the index.html made into android/app/src/main/assets/public/ folder?
@jcesarmobile here! https://github.com/ionic-team/capacitor/issues/989
Thanks!
Most helpful comment
I think that's not the problem.
@ratt in which folder do you have your app code?
When you init the project it ask for the folder, default value is "public", but Ionic apps have it in "src", or Cordova apps in "www". You probably used the default value but public folder doesn't exist in your project.
So update the
webDirvalue in thecapacitor.config.jsonfile to look like this: