Ionic-capacitor v3 unknown option ‘–npm-client’

Getting an error while creating the project : error: unknown option ‘–npm-client’.
Any help will be appreciated.

1 Like

@Smizz It looks like the npm-client option is no longer used, so you should be good to just omit it and re-run the command capacitor.cmd init AppName AppID --web-dir www

With appName being your appName, and AppID being your appId in capacitor.config.ts

@Smizz you can do 2 things:

  1. install testing version of ionic-cli: npm install -g @ionic/cli@testing
    or
  2. install older version of capacitor, for example in package.json:
    “dependencies”: { … , “@capacitor/android”: “^2.4.2”, “@capacitor/core”: “2.4.2”, …},
    “devDependencies”: { … “@capacitor/cli”: “2.4.2”, … }
    first run: npm uninstall capacitor
    then run: npm install capacitor
    The 2nd works for me just now, 10sec ago.
2 Likes

If you are using @ionic/cli, then run
npm install -g @ionic/cli@latest

If you are using the old ionic CLI, then run

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

awesome, installing an older version worked for me, thanks a bunch!

edit: installing latest @ionic/cli did nothing. Current version is 6.19.1

1 Like

this is not a working solution, still receiving > capacitor.cmd init ionic-app io.ionic.starter --npm-client npm
error: unknown option ‘–npm-client’

You are probably using an older version, what do you get if you run ionic --version? you should get 7.2.0 or newer.

yea. While I was not behind a version, old ‘ionic’ was still installed and took precedence over ionic/cli even though ionic/cli was at the correct version. That issue has its own solution that does not include npm