ekalinin/nodeenv

Question: How to prevent the creation of $HOME/.npm?

lestephane opened this issue · 1 comments

I have a write protected home directory in order to spot apps trying to write where they should not. After creating a virtual python environment + installing node through nodeenv, my npm install fails:

(cdkv2) ~ $ which npm
/home/lestephane/VirtualEnvironments/cdkv2/bin/npm
(cdkv2) ~ $ npm install aws-cdk@next typescript
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /home/lestephane/.npm
npm ERR! errno -13
npm ERR! 
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 1000:1000 "/home/lestephane/.npm"
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /home/lestephane/.npm
npm ERR! errno -13
npm ERR! 
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 1000:1000 "/home/lestephane/.npm"

Can I have it create the cache .npm directory somewhere else instead? If so, How?