sous-chefs/nodejs

npm installs as root but uses ~/.npm of the current user

Closed this issue · 3 comments

after a "sudo chef-client" run that included some usage of nodejs_npm, my own hidden .npm folder contains subdirs owned by root, causing errors when i try to use npm myself.

on a virtual machine in kitchen after a chef run on ubuntu 14:

vagrant@default-ubuntu-1404:~$ ls -l .npm/
total 656
drwxr-xr-x   3 root    root    4096 May  5 19:29 abbrev
drwxr-xr-x   3 root    root    4096 May  5 19:29 ansi-regex
drwxr-xr-x   3 root    root    4096 May  5 19:29 ansi-styles
drwxr-xr-x   3 root    root    4096 May  5 19:29 argparse
drwxr-xr-x   3 root    root    4096 May  5 19:29 array-find-index
drwxr-xr-x   3 root    root    4096 May  5 19:29 asn1
drwxr-xr-x   4 root    root    4096 May  5 19:29 assert-plus
drwxr-xr-x   3 root    root    4096 May  5 19:29 async
drwxr-xr-x   3 root    root    4096 May  5 19:29 aws-sign2
drwxr-xr-x   3 root    root    4096 May  5 19:29 balanced-match
drwxr-xr-x   3 root    root    4096 May  5 19:29 bl
drwxr-xr-x   3 root    root    4096 May  5 19:29 boom
drwxr-xr-x   3 root    root    4096 May  5 19:29 bower
drwxr-xr-x   3 root    root    4096 May  5 19:29 brace-expansion
drwxr-xr-x   3 root    root    4096 May  5 19:29 builtin-modules
drwxr-xr-x   3 root    root    4096 May  5 19:29 camelcase
drwxr-xr-x   3 root    root    4096 May  5 19:29 camelcase-keys
drwxr-xr-x   3 root    root    4096 May  5 19:29 caseless
drwxr-xr-x   3 root    root    4096 May  5 19:29 chalk
drwxr-xr-x   3 root    root    4096 May  5 19:29 coffee-script
drwxr-xr-x   3 root    root    4096 May  5 19:29 colors
drwxr-xr-x   3 root    root    4096 May  5 19:29 combined-stream
[more like this]

Try running sudo -s or sudo -i when you run chef-client. This isn't an issue with this cookbook or even npm.

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

Closing based on agreement with the recommendation from @joestump.