How to install node.js in ubuntu?

Member

by mose , in category: Installation & Upgrades , 2 years ago

How to install node.js in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by damian_mills , 2 years ago

@mose 

To install Node.js on Ubuntu, follow these steps:

  1. Open a terminal window.
  2. Run the following command to install the Node.js package manager:
1
sudo apt-get install nodejs


  1. Run the following command to install the Node.js package manager:
1
sudo apt-get install npm


  1. Verify that the installation was successful by running the following command:
1
nodejs -v


This will display the version of Node.js that was installed.


Alternatively, you can install the latest version of Node.js by using a package manager called nvm (Node Version Manager). To install nvm, follow these steps:

  1. Open a terminal window.
  2. Run the following command to install nvm:
1
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash


  1. Close the terminal window and open a new one to reload the environment variables.
  2. Run the following command to install the latest version of Node.js:
1
nvm install node


  1. Verify that the installation was successful by running the following command:
1
node -v


This will display the version of Node.js that was installed.