I have a blank ionic project, I am trying to integrate with capacitor with ionic to build android app.
I run this command. ionic capacitor add android
this throwing npm error please help me out to resolve this
C:\Users\i\Rabi\learn\ilearn>ionic capacitor add android
ionic integrations enable capacitor npm.cmd i --save -E @capacitor/core npm WARN @ionic/angular-toolkit@4.0.0 requires a peer of @angular-devkit/architect@^0.1200.0 but none is installed. You must install peer dependencies yourself. npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. npm WARN The package @angular/compiler is included as both a dev and production dependency. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
- @capacitor/core@3.1.2 updated 1 package and audited 1639 packages in 20.453s
130 packages are looking for funding run
npm fund
for detailsfound 3 moderate severity vulnerabilities run
npm audit fix
to fix them, ornpm audit
for detailsnpm.cmd i -D -E @capacitor/cli npm WARN @ionic/angular-toolkit@4.0.0 requires a peer of @angular-devkit/architect@^0.1200.0 but none is installed. You must install peer dependencies yourself. npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. npm WARN The package @angular/compiler is included as both a dev and production dependency. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
- @capacitor/cli@3.1.2 updated 1 package and audited 1639 packages in 17.196s
129 packages are looking for funding run
npm fund
for detailsfound 3 moderate severity vulnerabilities run
npm audit fix
to fix them, ornpm audit
for detailscapacitor.cmd init ilearn io.ionic.starter --npm-client npm error: unknown option '--npm-client' [ERROR] An error occurred while running subprocess capacitor.
capacitor.cmd init ilearn io.ionic.starter --npm-client npm exited with exit code 1. Re-running this command with the --verbose flag may provide more information.
I tried npm audit fix but no success
ionic capacitor add android
is used to add "android" in the ionic project, not to integrate capacitor.
To integrate capacitor you need to do these steps
npm install @capacitor/core
npm install @capacitor/cli --save-dev
npx cap init
Try this one
Open VS Code and type
1.ionic start
2.cd myApp => ionic build
3.npm install @capacitor/android
4.npx cap add android
5.npx cap open android
Could not follow then watch this video Ionic Capacitor Tutorial - Ionic Build Android & Ionic Build iOS by Code Swag
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.