'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!



Solution 1:[1]

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

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fernando Aureliano
Solution 2 Lindstrom