How to install node-v6.11.0-linux-x86.tar.xz in Ubuntu - node.js

I'm a windows user and I'm having a difficulty installing the latest version of NodeJS.
I've tried sudo apt-get install -y nodejs and it installed v0.10.25 version.
Can someone guide me how to install the tar.xz file properly.

Use nvm
It'll take care of everything.

Related

I have try to install node js 4.3.2 version but it give error

sudo apt-get install nodejs=4.3.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '4.3.2' for 'nodejs' was not found
Do you specifically want to install version 4.? The newest available is 12..
For installation of a specific version use apt-get install package=version -V. If this does not work for you please provide more info about your linux distro & version. You can always download the right Version of node manually on nodejs.org. You could also build it yourself.
Also check version availability for your system with sudo apt policy nodejs
Either way, first remove the previous installation completele, using
sudo apt-get purge package_name
then try installing the current version with PPA, by first running
sudo apt-get update
sudo apt-get install nodejs
after that you can check the version with node -v and for npm with npm -v
Try installing NodeJS using NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
check NVM is installed properly
nvm --version
To install the latest stable version
nvm install stable
Or a specific version
nvm install 12.4.0
nvm install 4
To list locally available Node JS versions
nvm list
Switch NodeJS version
nvm use version
Eg : nvm use 4
To make nodejs available for all users
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
Or Install it manually by downloading
https://nodejs.org/dist/v4.3.2/node-v4.3.2-linux-x64.tar.xz

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 upgrade node.js from 0.12 version to 4.0 version on Windows and Ubuntu

I already have installed Node.js v0.12.2 on Windows and Node.js v0.12.4 on Ubuntu 14.04 LTS. Can I just run the latest installer to upgrade it to v4.0.0 on Windows and run sudo apt-get update on Ubuntu?
Windows has an installer available at https://nodejs.org/en/download/
For Ubuntu, the official instructions are
sudo apt-get remove nodejs
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
Find where node is
which node
Replace it with
sudo ln -sf /usr/bin/nodejs /path/you/find/node
Maybe for future use on Windows, you can take a look at nvmw. Very easy to use and without manually modifying your configuration. When things break, you can just as easily switch back to older versions.
Similar package for Ubuntu: nvm

How to install nodejs 0.12.7

I've trying to install the latest version of nodejs
sudo apt-get nodejs
installs the version 0.12.25
When I downloaded the tar.gz from https://nodejs.org/ and installed
my node version upgraded to 0.12.7 but not nodejs version.
And when I tried like this
sudo apt-get install nodejs=0.12.7
E: Version '0.12.7' for 'nodejs' was not found
This error popped up. What can I do such that on entering
nodejs -v
I can get 0.12.7
Since there are a lot of Node.js versions, and there is also iojs, I suggest you to use a straightforward Node.js version manager, like the very good n.
So, first install n, then install Node.js 0.12.7 with:
$ n 0.12.7
When you install node.js from source by default it will install with node as name of the executable
node -v
Will show 0.12.7
If you need node.js for development purposes on your machine you can use nvm, it allows to install different versions of node.js and io.js, and easily switch between them
Remove node with command sudo apt-get remove node, then remove nodejs using sudo apt-get remove nodejs. After that try to install nodejs again with version you need sudo apt-get install nodejs=0.12.7.

Need Advice: Latest version of Node.js vs using Synaptic Package Manager?

I'm trying to get node.js and npm installed on my Ubuntu 11.10 installation, and I'm having a tricky time. I decided to go the route of downloading and compiling from the latest source because I want to use the new version of node.js - v0.6.0 instead of the older version that the synaptic package manager will install. However, I could not get npm set up correctly with it due to a "module not found" error. I was completely surprised at how little information I was able to find on the error.
Anyways, my goal here is to learn node.js, not to run a production environment. Should I give in and use v4.9 or is it really worth getting the newest version for the sake of learning, even if I have to go through the pain of keeping it updated and configuring it myself?
If you have Ubuntu, install it from Chris Lea's repo, it's always up to date with the last stable version (for ex now the version is 0.6.0 - as of today):
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Generally, you want to install node from source since the packages you find in package managers are usually out of date. 0.4.12 was the last stable before 0.6.0 that was released a few days ago. 0.4.9 is pretty out of date.
This is a old question, nowadays my preferred way to install node is by using nvm (Node Version Manager). This will allow you to have multiple versions of node installed and quickly switch version.
Installation:
Install C++ compiler
apt-get update
apt-get install build-essential libssl-dev
Install NVM
curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
source ~/.profile
Install node (select which version you want to install)
nvm install 6
Usage:
To set a default node version:
nvm alias default 0.12.7
To select a different installed version:
nvm use 4

Resources