So last night I was excited to get a community plugin working, which enables background location tracking in IOS and Android. I know want to create a fresh project to use the plugin, but I can’t remember which commands I used last night. To me it’s still not clear if ionic capacitor and npx cap are the same thing, or use the same capacitor package. I also don’t know how to check the version of capacitor. Something like ‘ionic capacitor version’.
This is what I do:
ionic start proj
cd proj
npm install @capacitor/cli@next @capacitor/core@next @capacitor/android@next - to update to v3
npm install @capacitor-community/background-geolocation - to install the plugin
ionic build
ionic capacitor add android
After the last command I get this error:
> capacitor.cmd init proj io.ionic.starter --npm-client npm
error: unknown option '--npm-client'
[ERROR] An error occurred while running subprocess capacitor.
At this point, any command starting with ionic capacitor … will get that error. What went wrong? What is the correct way to update to capacitor v3 and install the mentioned plugin ? In an Ionic project, when should I use ionic capacitor and when npx cap ?