Npm Ubuntu Issue Fix

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

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.

Leave a Reply

%d bloggers like this: