0

I'm trying to update the npm version in my terminal, but it throws the following error. This seems like a permission issue, but I am already the admin (there's only 1 user account on my Mac). Based on ChatGPT, it could be due to me installing node using "sudo" in the past. I just can't figure out the issue.

(base) isaacchew@Isaacs-MacBook-Air \~ % npm install -g npm@latest
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/bin/npm
npm ERR! dest /usr/local/bin/.npm-uJtxIR1m
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/bin/npm' -\> '/usr/local/bin/.npm-uJtxIR1m'
npm ERR!  \[Error: EACCES: permission denied, rename '/usr/local/bin/npm' -\> '/usr/local/bin/.npm-uJtxIR1m'\] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/local/bin/npm',
npm ERR!   dest: '/usr/local/bin/.npm-uJtxIR1m'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/isaacchew/.npm/\_logs/2023-06-22T03_19_27_598Z-debug-0.log

I have tried one of the methods heavily upvoted on stackoverflow, by using the "sudo chown -R $(whoami) ~/.npm" command, but it still throws the same error.

  • Does this answer your question? [How to fix EACCES issues with npm install](https://stackoverflow.com/questions/25290986/how-to-fix-eacces-issues-with-npm-install) – lambda-larry Jun 22 '23 at 16:35
  • No, the most upvoted answer still doesn't work for me. I'm still receiving the exact same error. – Isaac Chew Jun 23 '23 at 03:59

0 Answers0