How to Fix Missing write access to /usr/lib/node_modules NPM Issue on Ubuntu

By Rashid •  January 24th, 2021 • 

NPM is a package manager and I use it for my react native projects. Recently when I tried to install nativefier using npm install -g nativefier command, I faced the following error on my Ubuntu 20.04 PC.

npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules
npm ERR! errno -13
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! }

This is a write permission error on Ubuntu. This can be easily fixed by executing the command as root by adding sudo.

sudo npm install -g nativefier

Still the issue persists? you may try this solution too.


I am a fan of Ubuntu and I love all popular free and open source softwares. I wish everyone should try and support open source projects.