Fernando Aureliano
Fernando Aureliano

Reputation: 914

Ionic 6: unknown option '--npm-client'

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

Answers (5)

swanky
swanky

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

Manish Kumar Rai
Manish Kumar Rai

Reputation: 141

npm uninstall -g ionic
npm install -g @ionic/cli@latest

Try this

Upvotes: 10

B45i
B45i

Reputation: 2602

This issue is caused by older version of ionic-cli, you should upgrade the CLI version.

Upvotes: -1

Lindstrom
Lindstrom

Reputation: 815

I had the same issue and had to upgrade from node 14 to node 16.15 to make it work.

Upvotes: 0

Fernando Aureliano
Fernando Aureliano

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

Related Questions