I have found a caveat, it looks like when i installed node.js via the site(node.js), I ran into permission issues. Trying to use the “npm install -g npm@latest” would kick errors and then make basically stop working. Im on Mac OSX.
However, when i reinstalled it via brew, I’ve had no issues since. Could it be a permissions problem on the users end?(i.e. the package installs differently?)
I know this has been discussed before, but I dont think anyone has mentioned this before as a solution.
I ended up in nightmare land over this and it stopped me for a while from doing pretty much anything command line related. It was a never ending downward spiral of failed installs and sudo everything. I thought the whole thing was ridiculous and had no idea why anyone would ever leave the safety of a GUI like CodeKit for the command line. I knew something was off on my end, and I finally decided to get it sorted out.
I ended up completely uninstalling and reinstalling node. I was going to go the home brew route but read something, somewhere, that counseled against this. I really don’t remember what the reason was and I don’t know if it was valid or if I saved the link.
It would be interesting to read the article that was against Homebrew. I’ve never had any issues with it myself and it’s come in useful a couple of times with ansible to rollback to working versions:
brew info ansible # This lists previously installed versions
brew switch ansible 1.9.0.1 # This switches to the previously install working package
I don’t believe there was an article that suggested against it, just comments I ran across on various sites while trying to get my particular mess sorted out.
Again, I’m not saying that any of the concerns were valid or that installing via Homebrew is a bad idea, but I was at such a point of frustration with my set up that I didn’t want to take any chances.
What I had to do (after headaches and nightmares and a level of fear related to npm), was first uninstall node and npm, delete all the folders, and so forth. Then, install node with homebrew, using:
Sure, the biggest thing to keep in mind is not using sudo, as that’s the short trip to all sorts of permission problems. However, the beauty of using nvm is that you can install and use any version of node and npm you want, as well as avoiding sudo. Makes life a lot easier overall