Wednesday 18 January 2017

How can I correctly install Node on Ubuntu 14.04 (allowing for global installs without sudo)?

I installed Node on Ubuntu 14.04 by running the commands shown here:curl -sL http://ift.tt/26PL3TG | sudo -E bash - sudo apt-get install -y nodejs After that, I ran npm config get prefix and the output was /usr. I tried install something globally (using npm install -g), but got an EACCES error. I went to the "Fixing npm permissions" page and saw that option 1 (Change the permission to npm's default directory) was not an option if npm config get prefix outputs just /usr. So now I have a few questions:Why does the official method of installing Node not allow global installs without sudo?Why does the official method of installing Node install it into /usr and not /usr/local?What is the best way to deal with this? Is it following the instructions for option 2 (Change npm's default directory to another directory) to set the prefix to /usr/local? That doesn't seem right because then wouldn't every user on the system who wants to use Node have to update their PATH or set the NPM_CONFIG_PREFIX environment variable?

Submitted January 18, 2017 at 03:28PM by nrogers64

No comments:

Post a Comment