Fixing npm permissions

You may receive an EACCES error when you try to install a package globally.

Fixing npm permissions
by Nikhil M posted on Fri, Feb 10, 2017 in NodeJS

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 ./

Official npm Video

All product names, logos, and brands are property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement.

Write a comment on Fixing npm permissions