I'm following the "Get Going Quickly" from dojo.io and I've entered
npm i @dojo/cli @dojo/cli-create-app -g
but it fails with
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
How can avoid this without using sudo
? I’ve heard I should never use sudo
with npm
.
Is it correct? Should I really avoid it also in this case?
I'm on Fedora version 32 and
npm -v
6.14.4
I've also tried to issue only
npm i @dojo/cli -g
according to the Readme of dojo/cli but the error is the same.
Simply set your current user as owner of this node module folder as follow ( $USER refers to your current user name )
sudo chown -R $USER /usr/local/lib/node_modules