Install NodeJS, NPM
Before You Get Started: Remove Old Node Package to Avoid Conflicts
On Ubuntu, the Node.js package has a similar name to the older version, Node. The latter is an amateur packet radio program you can more than likely remove.
If you already have Node installed, you might want to remove it. Some Node.js tools might execute Node.js as Node instead of Node.js, causing conflicts.
You can look for and remove the Node package by executing these commands in a terminal. To access a terminal, navigate through the desktop menu:
Applications → Accessories → Terminal
Applications → Accessories → Terminal
Run this command and if it says install in the right column, Node is on your system:
1
2
3
|
$ dpkg --get-selections | grep node
ax25-node install
node install
|
If you found the old Node package installed, run this command to completely remove it:
1
|
sudo apt-get remove --purge node
|
Option 1: Install Node.js with Node Version Manager
First, make sure you have a C++ compiler. Open the terminal and install the build-essential and libssl-dev packages if needed. By default, Ubuntu does not come with these tools — but they can be installed in the command line.
Use apt-get to install the build-essential package:
1
|
sudo apt-get install build-essential checkinstall
|
Employ a similar process to get libssl-dev:
1
|
sudo apt-get install libssl-dev
|
You can install and update Node Version Manager, or nvm, by using cURL:
1
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
|
You will be asked to close and reopen the terminal. To verify that nvm has been successfully installed after you reopen the terminal, use:
1
|
command -v nvm
|
That command will output nvm if the installation worked.
To download, compile and install the latest version of Node:
1
|
nvm install 5.0
|
In any new shell, you’ll need to tell nvm which version to use:
1
|
nvm use 5.0
|
To set a default Node.js version to be used in any new shell, use the alias default:
1
|
nvm alias default node
|
Not only does nvm allow you to run newer versions of Node.js and npm, you can install and migrate any desired versions you’d prefer. Go to the nvm GitHub repository for more information.
Hire php developers – Save cost by hiring dedicated PHP developers & PHP programmer from this site.
ReplyDelete