Skip to content

Have to use sudo with npm -g #12

Description

@pajtai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions