"ionic: command not found" After trying to update Ionic CLI


#1

Hi everyone,

I was reading the freshly publish blog post on the brand new Super Starter and I read in the comments that the last CLI should be installed to run this Starter.
So, I open iTerm2 and type a sudo npm install -g ionic to update my CLI.
I ended up with a lot of error and then no “ionic” command can be run again.

Seems like I just mess up everything… O_O

I found the post here Ionic command not found after update ionic
But the solution did not work for me.

Below is a screenshot of what I am showed.

So now, I am stuck for real!

Thanks a bunch for helping out.
Joel


#2

I had the same issue with 2.1.18. Running the following is a temporary solution for now.

sudo npm install -g ionic@2.1.17

#3

I really wish people would stop doing npm things as root. If you use nvm and mess something up, all you have to do is blow away directories in ~/.nvm. When you use sudo, you have no clue or control over where things are being installed or clobbered, and correspondingly no idea how to repair the situation when things go wrong.


#4

On linux you have to deal with the native package manager. Using things outside of the package manager can cause all sorts of headaches for bugs an troubleshooting.

Both have their advantages and disadvantages. And this has nothing to do with the topic.


#5

Nonsense. I have used nvm to manage node packages for years, on various distributions. It works great, requires no superuser privileges, and allows multiple versions of node to be installed alongside one another with no problems.

I disagree. OP has no idea what in their system is broken where, and there is no single place anybody can tell them to clear out. Had they not run npm as root, people trying to help would know that the problem is isolated to their user’s home directory. At an absolute worst case, switching users would give them a blank slate. We can’t say that when sudo gets involved.


#6

I disagree. OP has no idea what in their system is broken where, and there is no single place anybody can tell them to clear out. Had they not run npm as root, people trying to help would know that the problem is isolated to their user’s home directory. At an absolute worst case, switching users would give them a blank slate. We can’t say that when sudo gets involved.

I had the exact same problem as the OP minutes before he posted. The fix I provided works.


#7

You may wish to try uninstalling ionic and cordova and then installing them from scratch as described in this issue.


#8

Great! The solution to globaly remove/re-install Cordova & Ionic works perfectly!

Thank you very much @rapropos. :slight_smile:


#9

So what you’re saying is the you have to install the Ionic globally? Same applies to cordova?