ionic-cli: Unable to find command: C:\Program Files\nodejs\node.exe after last update

Strange things happening, I did ionic serve command for running my ionic server, then I receive an option to update to the latest ionic version (3.20.0 => 4.0.0). After the successful update I receiving an error message each time before any ionic command:


    [ERROR] Unable to find command: C:\Program Files\nodejs\node.exe
            C:\Users\Username\AppData\Roaming\npm\node_modules\ionic\bin\ionic platform add android

What’s happening? I tried to reinstall node.js, then tried to install 7.0.0, then tried to reinstall ionic to previous version but nothing helps me. Npm and node commands works well. Why it stopped works even with the previous version?

Any advice?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@robisoft thanks. seems like this help me. I did:

npm uninstall -g ionic
npm install -g ionic

After installing CLI 4.0.1 I obtain the same error $ ionic g page gameDetail $ [ERROR] Unable to find command: /usr/local/bin/node /usr/local/bin/ionic g page gameDetail I solved it reinstalling ionic: $ sudo npm install ionic@latest -g

Did you check for a local installation of Ionic CLI in your project?

npm uninstall ionic

Great to hear!

So it looks like this is the solution:

npm uninstall -g ionic
npm install -g ionic

Additionally, check if the ionic package is installed locally. Remove it if it is with npm uninstall ionic.

I would try uninstalling Node again and removing the following directories:

  • C:\Users\username\AppData\Roaming\npm
  • C:\Users\username\AppData\Roaming\npm-cache

You will need to reinstall Node + any global npm packages you had.