0

So a while back Apple switched to Zshell and I had issues getting some things like NPM to work so I followed this answer on Stack and added this in the .zshrc source /Users/Scott/.bashrc

A few days ago I tried to update node and after using sudo n latest I had two versions of node

installed : v17.5.0 to /usr/local/bin/node 
active : v12.4.0 at /Users/scott/.nvm/versions/node/v12.4.0/bin/node

So I went into the .zshrc and commented out the source /Users/Scott/.bashrc and node updated to v17.5.0

However, I tried to do something with NPM and got an NPM EACCES permission error. I read that I needed to reinstall NPM so first I installed NVM and then reinstalled NPM. I checked the version of node and it went back to version 12.4, so I ran `sudo n latest' and I'm back to two nodejs in two different locations and I don't know what to do anymore!

Should I erase this from the .zshrc?

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  
# This loads nvm bash_completion

Any help is greatly appreciated!!

UPDATE I uninstalled the NVM version of node (based on @nthnua) and it updated to node 17.4. I ran n latest and it "installed" but everything said permission denied. Using NPM again is giving me permission errors

UPDATE I fixed the permission errors following this https://github.com/tj/n/issues/416#issuecomment-417808320

NoobCoderChick
  • 617
  • 3
  • 21
  • 40

1 Answers1

0

Seems like you have installed nodejs from the official source, which is located at /usr/local/bin/node. this causes commands like "npm install -g" not to work because of the insufficient permissions. If you plan on using nvm for managing node installs, you may want to uninstall the above mentioned installation. to do so refer to this: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

nthnua
  • 1