Home Blog About Contact

Fixing npm permissions

Fri, Feb 10, 17

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:

How to Fix?

Please check this gist

Official npm Video

Full Version of Fixing npm permissions