How to install nodejs 6.7.0 on Ubuntu 14 - node.js

I have found some guides (for ex. Install latest nodejs version in ubuntu 14.04) how to install updated version of NodeJS, also followed the official one that says to use
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
which is the same thing as in the SO guide above.
However, the version of node I get is 6.3.1 but I want the latest 6.7.0. I have installed 6.7.0 on OSX via brew but don't know how to get it on Ubuntu. Is there any way to do it, using APT preferably?

I have done this way:-
sudo npm install n -g
sudo n 6.7.0
Alternatively for latest stable version you can do this:-
sudo n stable
And For latest version
sudo n latest

Related

Node JS - Not able to install node js version 8.9 or greater in ubuntu 16.04

I have tried various methods by which I can install the latest version of nodejs on my operating system but was unsuccessful.
In the end it always ends up installing
version v.4.2.6
When I run the commands below, it always shows an error as shared in the screenshots of my terminal.
Current release:
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
or LTS release:
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
// throws error
Version:
Trying to execute node 11 script:
o/p of the above script:
Please guide me how can it be fixed. I have followed some of the other stackoverflow links but couldn't make it.
Thanks you for your help.
I recommand uninstalling your current NodeJS version and install nvm instead.
Then you can manage all node version with nvm.
Method 1:
I followed this link and it was successful:
updating nodejs on ubuntu 16.04
Method 2:
You can either skip above link and follow the below steps:
Using Node Version Manager (NVM):
Install it by following instructions here
Test your installation:
close your current terminal, open a new terminal, and run:
command -v nvm
Use it to install as many versions as u like:
nvm install 8 # Install nodejs 8
nvm install --lts # Install latest LTS (Long Term Support) version
List installed versions:
nvm ls
Use a specific version:
nvm use 8 # Use this version on this shell
Set defaults:
nvm alias default 8 # Default to nodejs 8 on this shell
nvm alias default node # always use latest available as default nodejs for all shells
If you have npm installed -
run
sudo npm cache clean -f
sudo npm install -g n
install n globally
npm i -g n
then switch to the latest stable node version using n
n stable

Unable to install of latest version of nodejs

I was having nodejs version 4.2.6 in my ubuntu 16.04 pc.
I tried to install n using command sudo npm install -g n, and the following errors came out.
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at https://nodejs.org/
I uninstalled the current nodejs and then reinstalled it .But everytime the version 4.2.6 is installed.I am not getting why the latest version is not installed.I followed this link to reinstall my nodejs
enter link description here
Do i need any others updated to have latest nodejs ?Please guide me
Here are the steps to follow:
First clear cache.
Then upgrade npm
Then install stable version if Node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
If that still didt work
Remove NodeJs and Npm
Install Node
sudo apt remove nodejs npm
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
You can install latest version of nodejs by adding local apt repo as mention in official doc,
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
and then use n or nvm module to manage version.
Update: You should uninstall older version before installing newer version
sudo apt-get purge nodejs
sudo apt-get autoremove
you can use nvm and install severall version of node and switch on node version
this link help you
enter link description here
use NVM to manage all node versions

How to install nodejs 6.x version on centos 6?

I use centos release 6.9
current nodejs version v0.10.48
I want install nodejs 6.x version
and I try
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs
but occur error
enter image description here
how to install nodejs 6.x version on centos 6?
The easiest way is use n to switch the node version
To avoid some issue after version changed, please run this command.
npm cache clean -f
Then install n
npm i -g n
Now, use n install node version you want. (I suggest you lts one.)
n lts
here is n documentation https://github.com/tj/n

updating nodejs on ubuntu 16.04

I was recently going through the version of node in my ubuntu 16.04 when node -v command was used it shows me version 6.9.1 but when nodejs -v it shows 6.9.2 previously before using this commands npm update command was used.
Now what's these difference in node -v and nodejs -v? and how to update to the latest LTS version of node/nodejs?
To update, you can install n
sudo npm install -g n
Then just :
sudo n latest
or a specific version
sudo n 8.9.0
According to official docs to install node on Debian and Ubuntu based distributions:
node v12 (Old)
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
node v14 (For new users: install this one):
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
node v15 (Current version):
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
Other older versions:
Just replace the desired version number in the link above.
Optional: install build tools
To compile and install native packages
sudo apt-get install -y build-essential
To update node to the latest version just:
sudo apt update
sudo apt upgrade
To keep npm updated
sudo npm i -g npm
To find out other versions try npm info npm and in versions find your desired version and replace [version-tag] with that version tag in npm i -g npm#[version-tag]
And I also recommend trying yarn instead of npm
Using Node Version Manager (NVM):
Install it:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Test your installation:
close your current terminal, open a new terminal, and run:
command -v nvm
Use it to install as many versions as u like:
nvm install 8 # Install nodejs 8
nvm install --lts # Install latest LTS (Long Term Support) version
List installed versions:
nvm ls
Use a specific version:
nvm use 8 # Use this version on this shell
Set defaults:
nvm alias default 8 # Default to nodejs 8 on this shell
nvm alias default node # always use latest available as default nodejs for all shells
Use n module from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
To upgrade to latest version (and not current stable) version, you can use
sudo n latest
Undo :
sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/node
sudo n rm 6.0.0 # replace number with version of Node that was installed
sudo npm uninstall -g n
Use sudo apt-get install --only-upgrade nodejs to upgrade node (and only upgrade node) using the package manager.
The package name is nodejs, see https://stackoverflow.com/a/18130296/4578017 for details.
You can also use nvm to install and update node.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
Then restart the terminal, use nvm ls-remote to get latest version list of node, and use nvm install lts/* to install latest LTS version.
nvm is more recommended way to install or update node, even if you are not going to switch versions.
Difference: When I first installed node, it installed as 'nodejs'. When I upgraded it, it created 'node'. By executing node, we are actually executing nodejs. Node is just a reference to nodejs.
From my experience, when I upgraded, it affected both the versions (as it is supposed to). When I do nodejs -v or node -v, I get the new version.
Upgrading: npm update is used to update the packages in the current directory. Check https://docs.npmjs.com/cli/update
To upgrade node version, based on the OS you are using, follow the commands here https://nodejs.org/en/download/package-manager/
Please refer nodejs official site for installation instructions at the following link
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
Anyway, please find the commands to install nodejs version 10 in ubuntu below.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install npm#latest -g
Try this:
Edit or create the file :nodesource.list
sudo gedit /etc/apt/sources.list.d/nodesource.list
Insert this text:
deb https://deb.nodesource.com/node_10.x bionic main
deb-src https://deb.nodesource.com/node_10.x bionic main
Run these commands:
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
sudo sh -c "echo deb https://deb.nodesource.com/node_10.x cosmic main /etc/apt/sources.list.d/nodesource.list"
sudo apt-get update
sudo apt-get install nodejs
node and nodejs are two different packages in Ubuntu software, node is an up-to-date snap package, whereas nodejs is an older version of apt package
to update to the latest LTS version of node:
Install NVM on Ubuntu 22.04|20.04|18.04 with the command:
wget https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh
bash install.sh
After the installation, source the profile:
source ~/.bashrc
Verify the NVM installation:
nvm -v
Install Node.js 18 LTS on Ubuntu 22.04|20.04|18.04 as shown:
nvm install v18
Install the latest version using the command:
nvm install node
Once complete, verify the installation:
node -v
Run these commands:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
source ~/.profile
nvm ls-remote
nvm install v9.10.1
nvm use v9.10.1
node -v
Update latest version Nodejs :
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
I am using Ubuntu 20.04.4 LTS and got the issue during upgrade node js. The current LTS version is 16.14.2 According to the NodeSource Node.js Binary Distributions document
Node.js v16.x:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
if you still get the issue you can also try the following:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
apt-get update
sudo npm cache clean -f
sudo apt-get install -y nodejs
Node.js Current:
It's work for me..
Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs
I am also facing problem while going to install react app, so i found the solution,
npx create-react-app shodkk
First install the npm latest version using
sudo npm install -g npm#8.4.1
So to install the node 16.x you need to go terminal and type
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
Doing this you install the node LTS that is 16.14.o at the time of writing this post.
Try this 2-3 times, also do the
sudo apt-get update
Then Now install the package using
sudo apt-get install -y nodejs
At last this helps you remove any unwanted package, that remains after updating that is depreciated and need not be there, So use autoremove command.
sudo apt autoremove
So if like the post, Upvote and motivate me to write more, thanks, givingBack to the Community.
Use n module from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
To upgrade to latest version (and not current stable) version, you can use
sudo n latest
To undo:
sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/node
sudo n rm 6.0.0 # replace number with version of Node that was installed
sudo npm uninstall -g n

How to install latest node version on Ubuntu?

I want to install the latest node (v6.2.0 at the time of writing) on Ubuntu. But as I do
sudo apt-get nodejs
This installed v0.10.37.
Can you please help me in installing the latest version of node js and also npm latest version?
This is very simple,
Grab the Linux node distribution from here:
https://nodejs.org/dist/v6.2.0/
Open Terminal and type below command:
sudo tar -C /usr/local --strip-components 1 -xzf ~/Downloads/node-v6.2.0-linux-x64.tar.gz
ls -l /usr/local/bin/node
That`s it.
Now check your node version by typing:
node -v
npm -v
One can install any version of node in Ubuntu using above steps.
There is official instruction:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Follow https://deb.nodesource.com/setup_6.x to read shell script before execute above commands.
You always must to know what you run, especially by sudo.
Any version of node install is very easy
Just click Node.js scroll down and go Installation instructions and chose which version you want to install
To Install 12.x version of node:
Open your terminal [Ctrl+Alt+t]
execute below command
Using Ubuntu
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
or
Using Debian, as root
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs
To remove previous version use command
sudo npm cache clean -f
sudo npm install -g n
and then for latest version
sudo n latest
Or for stable version
sudo n stable
By far the most convenient way to install and manage node versions on your machine is the Node Version Manager a.k.a nvm. Just follow the installation instructions in the repo and after you have it installed run
nvm install 6.2.0
I would suggest installing through package manager to make sure it installs with accurate dependencies.
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Also, use NPM
sudo apt-get install npm
to install modules, like so:
npm install express
Install the package through the official download page, in a .deb format. Go ahead and grab the newest version here:
https://nodejs.org/download/release/latest/
Just go ahead and download your desired version and double-click on the downloaded .deb file, and you're good to go. npm comes with nodejs, btw.
RECOMMENDED READING
https://www.npmjs.com/package/npm
EDIT
If you wish to completely reinstall nodejs, check out the script located here:
https://gist.github.com/brock/5b1b70590e1171c4ab54
and check out this:
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
It says Mac OSX, but it'll work perfectly fine in ubuntu, too.
depends on what version of latest nodejs you want to install
if LTS version or current latest version, then from PPA
latest LTS version
apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get install nodejs
current latest version
apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
apt-get install nodejs
source: https://codesposts.com/ydOAwynW
Install the snap package
The easiest method to install Node.js on Ubuntu is to use the snap package. Just search for node on Ubuntu Software store and install the first one.
Or if you prefer command line:
sudo snap install node --classic
Alternate method: NVM
If you can't use snaps for some reason, like from a WSL environment, then Node Version Manager (NVM) is the way to go. It's safer than upgrading the node packages in Ubuntu to unsupported versions from PPAs or 3rd party repos, which may cause conflicts or breakages in apt package management system. Compared to NVM, manual installations from tarballs are harder to maintain and upgrade. Follow these steps to install the latest node using NVM:
Step 1: Install NVM
Run this command in Terminal:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
Step 2: Install node
Once NVM installation is complete, close and reopen Terminal. Then run this command:
nvm install node
Step 3: Check node version
Run these commands:
node --version
npm --version
If everything went well, you'll see the latest node and npm versions as output. That's all, node is installed and ready to run! 😊
Note: This question is similar to the AskUbuntu question "How do I install the latest version of node.js?" and my answer equally applies. I'm reproducing my answer here to ensure a full complete answer exists rather than just a link.
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y nano git curl vim htop gnupg2 && curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && sudo apt-get install -y nodejs
Install NodeJS 14x and npm 7x in Ubuntu 2020 LTS
Install Nodesource: curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
Install NodeJS: sudo apt-get install -y nodejs
Install latest npm: npm install -g npm#latest
For certain npm packages to run: sudo apt install build-essential
The easiest way is using a single line command is sudo snap install node --classic
It installs the latest stable node version from snap store.

Resources