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?
@Neustart Can you post the full output of ionic --verbose?
@dwieeb sure, the same error:
PS C:\Projects\app-ionic-master> ionic --verbose
[ERROR] Unable to find command: C:\Program Files\nodejs\node.exe
C:\Users\Username\AppData\Roaming\npm\node_modules\ionic\bin\ionic
How about where ionic?
I'm just trying to figure out what might be wrong. I'm not seeing this on my Windows machine.
@dwieeb
C:\Users\username>where ionic
C:\Users\username\AppData\Roaming\npm\ionic
C:\Users\username\AppData\Roaming\npm\ionic.cmd
Do you have any suggestion how to reinstall something which can help me?
I would try uninstalling Node again and removing the following directories:
C:\Users\username\AppData\Roaming\npmC:\Users\username\AppData\Roaming\npm-cacheYou will need to reinstall Node + any global npm packages you had.
Additionally, check if the ionic package is installed locally. Remove it if it is with npm uninstall ionic.
@dwieeb unfortunately no success :(
I did all that you described but the same error...
this is block me half of the day :(
@dwieeb I have a folder with the same project with but without last month changes. I tried ionic serve command there and all works properly, it asked me about update and I pressed 'no' then server successfully run.
So the problem is in my project .. what should I remove to fix this, do you have any ideas ?
Did you check for a local installation of Ionic CLI in your project?
npm uninstall 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
@robisoft thanks. seems like this help me. I did:
npm uninstall -g ionic
npm install -g ionic
@dwieeb I've solved an issue using command above, but now I faced another one:
PS C:\Projects\app-ionic-master> ionic serve
> ionic-v1 serve --host 0.0.0.0 --port 8101 --lr-port 35729 --dev-port 53703
[v1] 'ionic-v1' is not recognized as an internal or external command,
[v1] operable program or batch file.
[INFO] Looks like @ionic/v1-toolkit isn't installed in this project.
This package is required for ionic serve. For more details, please see the CHANGELOG:
https://github.com/ionic-team/ionic-cli/blob/master/packages/ionic/CHANGELOG.md#4.0.0
[ERROR] A utility CLI has unexpectedly closed.
The Ionic CLI will exit. Please check any output above for error details.
I am trying to do npm install ionic/v1-toolkit but receiving an error each time:
npm install ionic/v1-toolkit
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://[email protected]/ionic/v1-toolkit.git
npm ERR!
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Username\AppData\Roaming\npm-cache\_logs\2018-07-26T09_29_24_537Z-debug.log
@dwieeb no matter. I've solved it by using npm i @ionic/v1-toolkit and then reboot PC
Great to hear!
So it looks like this is the solution:
npm uninstall -g ionic
npm install -g ionic
@robisoft You should never run npm commands with sudo. You don't know what could the dependencies brought by the packages you're using do with all this rights...
Just uninstall the last npm package you install by command
npm uninstall --save @ionic-native/
Most helpful comment
@robisoft thanks. seems like this help me. I did: