ansible-nodejs-role
ansible-nodejs-role copied to clipboard
Have to use sudo with npm -g
This causes issues with some npms, e.g. bower.
To get around it I added the following to the task:
- name: Set place for global npms
shell: npm config set prefix '/home/{{ node_user }}/.npm-packages'
sudo: no
- name: Add it to your paths
shell: echo 'export PATH="$PATH:$HOME/.npm-packages/bin"' >> /home/{{ node_user }}/.zshrc
I didn't do a pull request because I wasn't sure how to inorporate the node_user and .zshrc vs .bashrc etc.... but the above fixes the issue and lets you use npm -g without sudo for node_user