Not able to integrate ionic with capacitor , npm throws error
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/[email protected] requires a peer of @angular-devkit/architect@^0.1200.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] 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: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
- @capacitor/[email protected] 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/[email protected] requires a peer of @angular-devkit/architect@^0.1200.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] 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: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
- @capacitor/[email protected] 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
Solution 1:
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