Best method to install nodejs + npm without headaches on ubuntu 14.04

After fiddling around and not exactly knowing why some ways worked and others not, I believe the following instructions are quite fool-proof. I have successfully tested it on an Amazon EC2 Ubuntu instance as non-Root user.

These steps helped me to avoid conflict  caused by the $NODE_PATH variable and it’s interferences with the native environment variable of npm .

The NodeJS and NPM packages in the Ubuntu 14.04 repository can not be used because they are outdated.

Follow the instructions from the NodeJS Website:

  • curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
  • sudo apt-get install -y nodejs
  • Optional: install build toolsTo compile and install native addons from npm you may also need to install build tools:
    sudo apt-get install -y build-essential
  • sudo npm install -g npm  (to update npm)

     


Votre commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l’aide de votre compte WordPress.com. Déconnexion /  Changer )

Image Twitter

Vous commentez à l’aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l’aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s