I\'m trying to upgrade to the latest version of node. I\'m following the instructions at http://davidwalsh.name/upgrade-nodejs
But when I do:
sudo np
For debian after installing node enter
curl -k -O -L https://npmjs.org/install.sh
ln -s /usr/bin/nodejs /usr/bin/node
sh install.sh
If you have downloaded node package and extracted somewhere like /opt
you can simply create symbolic link inside /usr/local/bin
.
/usr/local/bin/npm -> /opt/node-v4.6.0-linux-x64/bin/npm
/usr/local/bin/node -> /opt/node-v4.6.0-linux-x64/bin/node
Work for me Resolving EACCES permissions errors when installing packages globally
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use hidden directory in your home directory.
Back up your computer. On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
source ~/.profile
To test your new configuration, install a package globally without using sudo:
npm install -g jshint
Appended npm binary path to sudo path using visudo and editing "secure_path"
Now "sudo npm" works
simply reinstall .
On RHEL, CentOS and Fedora
sudo yum remove nodejs npm
sudo dnf remove nodejs npm [On Fedora 22+ versions]
then
yum -y install nodejs npm
dnf -y install nodejs npm [On Fedora 22+ versions]
easy!.. both node and npm works like a charm now!
For MAC users, the follow steps worked for me.
If you get Error for Brew, Here's the command you need to type first in the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ brew update
$ brew uninstall node
$ brew install node
$ brew postinstall