Fixing npm permissions

Thu Feb 09 2017

Fixing npm permissions

This indicates that you do not have permission to write to the directories that npm uses to store global packages and commands.

How bad is it?

npm ERR! Linux 3.19.0-49-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "hapi"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/light/npm-debug.log

Read official documentation

You can fix this problem using one of three options:

  • Change the permission to npm’s default directory.
  • Change npm’s default directory to another directory.
  • Install node with a package manager that takes care of this for you.

How to Fix?

Please check this gist

  • Run cd ~
  • Run wget -O
  • Run chmod +x
  • Run ./
Leave a comment

To make a comment, please send an e-mail using the button below. Your e-mail address won't be shared and will be deleted from our records after the comment is published. If you don't want your real name to be credited alongside your comment, please specify the name you would like to use. If you would like your name to link to a specific URL, please share that as well. Thank you.

Comment via email
Nikhil M
Nikhil M

Entrepreneur / Privacy Freak / Humanist / Blockchain / Ethereum / Elixir / Digital Security / Online Privacy

Tags Recent Blogs