Alternative location for the .npm folder (to avoid a home connected to NFS)

I have a home folder installed on NFS and I'm trying to configure global packages through npm, for example:

sudo npm install -g jshint

This gives me an error because in sudo I cannot create anything on the remote server (tried this outside of npm)

npm ERR! Error: EACCES, open '/home/explunit/.npm/a02a2468-jshint.lock'
npm ERR!  { [Error: EACCES, open '/home/explunit/.npm/a02a2468-jshint.lock']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/explunit/.npm/a02a2468-jshint.lock' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

I am sure that someone will come in 2 minutes and say: “Do not use sudo - the real developer will understand how to configure node / npm without it!”, But a) it was never clear to me how it works, considering that npm readme offers sudo, and b) in this case, I really don't want anything related to my specific user (this is the build server)

, , , npm - .npm?

+5
1

, .

npm config set cache /SOMEWHERE/ELSE

/SOMEWHERE/ELSE -, .

+7

All Articles