Ionic: command not found


#1

After upgrading ionic CLI i cant use ionic commands anymore, i get the command not found error everytime, already tried npm uninstall -g ionic , npm uninstall -g cordova, npm cache clean , and npm install -g ionic cordova. I get the same error. Any clues? i think its an issue with node_modules path, i tried yesterday changing the ionic -g root with a command that i do not remember something like get prefix before that i could run the ionic comands but they would not work sayng “path not found” or something like it. Any ideas? Thanks in advance


#2

Try to reboot your PC/Laptop.
It’s working for me.


#3

Same result… i did this yesterday npm config set prefix /usr/local. what is the right prefix ? i think usr/local is wrong. Im running windows 10 btw


#4

One solution: Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again. The problem should be gone.


#5

Ye ill try that =/ didnt want to have this trouble, im tryng to understand a bit more of ionic pathing, where exacly do i need to have node_modules in windows?


#6

Didnt work, again when i install ionic i get the usr/local/node_modules file, seems like the npm config set prefix /usr/local that i did yesterday is permanent unless i change it. Do u know how to reverse this to default? or to right path for windows 10?


#7

npm recently changed the way it updates, making it much harder to do, esp with a script. nvm-windows has an outstanding Help Wanted to fix this, and you might be running into it too. Just cold-install the most recent version of NodeJS, whichever track you prefer, and live with the version of npm that comes with it. Anyone who needs the bleeding edge of npm has the skills to update it manually.

Never, ever, unless you want potential long term issues, install any of this stuff as administrator. Did you do that? It feels that way based on your errors. If that’s what happened, learn from the past.


#8

Ye i did install the latest node.js now, but it wont help, i need to revert this npm config set prefix /usr/local. Same thing happend when i try to install ionic via the latest node, i get the usr/local/node-modules path. And when i try to execute any comand with ionic

ionic -v
module.js:473
throw err;
^

Error: Cannot find module 'C:\Users\kmx123\AppData\Roaming\npm\node_modules\ionic\bin\ionic’
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:453:25)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:607:3


#9

That makes no sense if you have a clean node install. You aren’t removing what you think you are removing. Manually put everything except your source code into the recycle bin.