Reputation: 914
I have a project with ionic 6 and capacitor, when I run ionic serve
it work like a charm and I can see the project in my browser, but then when I run ionic capacitor build android
I got this error:
error: unknown option '--npm-client'
[ERROR] An error occurred while running subprocess capacitor.
I have tried to use this solution, but it didn't work.
It says to:
npm uninstall -g ionic
npm uninstall -g @ionic/cli
npm install -g @ionic/cli
but I still get the same error. Someone already got the same error before?
Thanks!
Upvotes: 2
Views: 6394
Reputation: 81
Uninstalling cli and installing latest cli did not work for me. The following steps worked:
1. ionic build
2. npm install @capacitor/android
3. npx cap init
4. npx cap add android
Upvotes: 2
Reputation: 141
npm uninstall -g ionic
npm install -g @ionic/cli@latest
Try this
Upvotes: 10
Reputation: 2602
This issue is caused by older version of ionic-cli, you should upgrade the CLI version.
Upvotes: -1
Reputation: 815
I had the same issue and had to upgrade from node 14 to node 16.15 to make it work.
Upvotes: 0
Reputation: 914
I fix it updating to the last version with this, because the upgrade commands didn't work for me.
cd /tmp
wget https://registry.npmjs.org/@ionic/cli/-/cli-6.19.0.tgz
sudo npm -g install cli-6.19.0.tgz
Upvotes: 1