Node.js will not Update to Latest Version - node.js

I currently have node.js version v7.6.0
According to documentation, v8.5.0 is the latest version of node.
I have tried installing it using https://nodejs.org/en/
node -v returns v7.6.0.
I have tried the following commands in Terminal:
[sudo] npm install npm#latest -g
npm install npm#latest -g
sudo apt-get update
sudo n 0.8.21
sudo n latest
lsb_release -a
Each command appears to recognize and install the latest version, but the final message reads:
Installed: v7.6.0
I've altered my BASH Profile to include:
/usr/local/bin/node
/usr/local/bin/npm
My version still shows v7.6.0 as the current version running.
Side Note:
My NPM is up-to-date at version 5.4.2
Is there any other way to update my Node to the current version?

In order to update to the latest version of node, use commands:
nvm use system
nvm run system --version
nvm install node
These commands will bring you to the latest version of node.
Thank you!

Related

Update Node JS on Ubuntu

Ubuntu 20.04.3 LTS
Version 14.0.0 is installed, node -v always shows it. Although in the list of programs Node appears as 16.13.1. I can manually change the version via nvm, but this is very inconvenient. How to make sure that there is no ghost on my computer about version 14?
You can use n module from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
to update to the latest version use
sudo n latest
Explained
I solved this problem
rm -rf ~/.nvm
nvm install 16

sudo npm i npm or sudo npm install npm#latest -g throws an error of EACCES:permission denied

I have npm v 5.6 and I installed node version 10.1 so the current npm doesn't support node version while updating npm I am getting EACCES permission denied error. I tried removing npm directory and updating via several command the npm version is stuck at 5.6. Help!!
Using Ubuntu v16.04 LTS.
I tried installing different nodejs version too but it also doesnt change npm version(npm v5.6).
visit here for the screenshot
I'd recommend using a version manager (such as nvm) to install multiple versions of Node.js and switch between them at will.
First off, make sure you have git and the build-essential package installed:
sudo apt-get update
sudo apt-get install build-essential git
Then install nvm with cURL (run this command in your terminal):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
This will clone the nvm repository to ~/.nvm and will make the required changes to your bash profile, so that nvm is available from anywhere in your terminal.
Reload your bash profile:
source ~/.bashrc
and verify the install by typing:
command -v nvm
which should output 'nvm' if the installation was successful.
(if this doesn't work, just close, then reopen your terminal)
And that’s it, nvm is installed and ready to be used.
Now, to download, compile, and install the latest release of Node, run the following from your terminal:
nvm install node
And then in any new shell just use the installed version:
nvm use node
Finally, verify the correct version is being used:
node -v
=> 10.5.0
There's a lot more to using nvm, such as installing multiple Node versions.
You can read more about that here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
HTH

How to downgrade Node version

I want to downgrade my Node version from the latest to v6.10.3.
But nothing worked so far. Tried NVM and it gives an error as well by saying make command is not found. How can I downgrade Node?
Warning:
This answer does not support Windows OS
You can use n for node's version management. There is a simple intro for n.
$ npm install -g n
$ n 6.10.3
this is very easy to use.
then you can show your node version:
$ node -v
v6.10.3
For windows nvm is a well-received tool.
For windows:
Steps
Go to Control panel> program and features>Node.js then uninstall
Go to website: https://nodejs.org/en/ and download the version and install.
Determining your Node version
node -v // or node --version
npm -v // npm version or long npm --version
Ensure that you have n installed
sudo npm install -g n // -g for global installation
Upgrading to the latest stable version
sudo n stable
Changing to a specific version
sudo n 10.16.0
Answer inspired by this article.
In Mac there is a fast method with brew:
brew search node
You see some version, for example: node#10 node#12 ... Then
brew unlink node
And now select a before version for example node#12
brew link --overwrite --force node#12
Ready, you have downgraded you node version.
This may be due to version incompatibility between your code and the version you have installed.
In my case I was using v8.12.0 for development (locally) and installed latest version v13.7.0 on the server.
So using nvm I switched the node version to v8.12.0 with the below command:
> nvm install 8.12.0 // to install the version I wanted
> nvm use 8.12.0 // use the installed version
NOTE: You need to install nvm on your system to use nvm.
You should try this solution before trying solutions like installing build-essentials or uninstalling the current node version because you could switch between versions easily than reverting all the installations/uninstallations that you've done.
For windows 10,
Uninstalling the node from the "Add or remove programs"
Installing the required version from https://nodejs.org/en/
worked for me.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
sudo npm install -g n
sudo n 10.15
npm install
npm audit fix
npm start
If you're on Windows I suggest manually uninstalling node and installing chocolatey to handle your node installation. choco is a great CLI for provisioning a ton of popular software.
Then you can just do,
choco install nodejs --version $VersionNumber
and if you already have it installed via chocolatey you can do,
choco uninstall nodejs
choco install nodejs --version $VersionNumber
For example,
choco uninstall nodejs
choco install nodejs --version 12.9.1
If you are on macOS and are not using NVM, the simplest way is to run the installer that comes from node.js web site. It it clever enough to manage substitution of your current installation with the new one, even if it is an older one. At least this worked for me.
Try using the following commands
//For make issues
sudo apt-get install build-essential
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
//To uninstall a node version
nvm uninstall <current version>
nvm install 6.10.3
nvm use 6.10.3
//check with
node -v
Steps to downgrade to node8
brew install node#8
brew link node#8 --force
if warning remove the folder and files as indicated in the warning then again the command :
brew link node#8 --force
For windows users, you guys can downgrade using following commands.
npm uninstall -g node
npm install -g node#version
#version is your specified version, example : 12.22.3(little old)
Can find node releases here https://nodejs.org/en/download/releases/
I have used brew in mac to downgrade the node
follow the steps you will have the result:
brew search node (here you can see the version eg: node#10, node#12, node#14)
brew unlink node
brew install < node version > (eg: node#12)
brew link --overwrite node#12
If you are using nvm, following are the ways -
1. nvm install node_version
2. nvm use --delete-prefix node_version
For more insights, see this image -
Ubuntu:
nvm list
nvm use <version>
nvm list // Shows all the versions on your machine. Of course have your version installed.
nvm use // Use this version
it seems to be a compatibility issue, run
sudo n 14
then npm install or yarn install again. It will work
In case of windows, one of the options you have is to uninstall current version of Node. Then, go to the node website and download the desired version and install this last one instead.
I had to downgrade node to v10.16.0
sudo n 10.16.0
nvm use v10.16.0
this solved the problem for me
WINDOWS: Best way that you can do it and to not lose time.
Go to control panel
Uninstall Program
Uninstall node
Then go and find the version that you want to install, install it from the beginning.
Link with node versions: https://nodejs.org/uk/blog/release/
Here is a simple solution
Go to this link and download & install the suitable nvm setup on your computer
https://github.com/coreybutler/nvm-windows
Type nvm list to get list of installed node versions
Type nvm install <node-version>
Type nvm use <version>
here we go you got node version you want.
Browse here to find node versions => https://nodejs.org/en/download/releases/
The Node.js team suggests to use the following Node.js version managers to switch between different versions of Node:
OSX or Linux:
nvm
n
Windows:
nodist
nvm-windows
I personally made good experiences using "nvm-windows" on Windows 11.
I would recommend using NVS (Node Version Switcher).
You can see the source here and all you need is a package manager. Like Chocolatey or Homebrew.
Install it
choco install nvs
Add a version:
nvs add v16
Switch to any version you installed
nvs use v16
At the end if you "run node -v" you'll get the current you've switched.

Error: npm is known not to run on Node.js V4.2.6

how can I solve the following error? I use Ubuntu 16.
When I run any npm command such as "npm run dev" I get this error:
ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is
supported but the specific version you're running has a bug known to
break npm. Please update to at least ${rel.min} to use this version of
npm. You can find the latest release of Node.js at https://nodejs.org/
First, Uninstall completely nodejs and npm.
sudo apt remove nodejs npm
Then, reinstall it over the link below:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Refer: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
You can try downgrading the node version to switch from the bugged version using the following, upgrading also works if your app supports latest versions.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
nvm install 4.2.5
nvm use 4.2.5
//check with
node -v
//To uninstall a node version
nvm uninstall 4.2.6
I just had this issue on Ubuntu 16. Use n to update to the latest version
sudo n latest
That should settle it.
I download latest install package from https://nodejs.org/en/ and reinstall it. Solve it!
You can also use NVM - I did this to solve the same problem.
first type
nvm ls-remote to view the latest versions available,
then
nvm install [version] (I used v8.7.0)
everything should be fine after that.
I had a similar problem but my project is part of a bigger system so neither switching to nvm instead of npm nor upgrading my version of Node.js were options.
However, moving npm backwards to a previous version was an option. I found 4.6.1 worked without complaint.
sudo npm install -g npm#4.6.1
This version of npm did not complain.
I fixed the same issue with Ubuntu 16.04 by using following commands step by step.
Uninstall nodejs and install version 8.0
$ sudo apt remove nodejs npm
$ curl -o-
https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
$ nvm install 8.0
$ nvm use 8.0
$ node -v
v8.0.0
Get latest release with
$ nvm install node
Then run the following
$ nvm alias default stable_node_version

How to update nodejs from 6.x to 8.x?

Simple question - How to update nodejs from 6.x to 8.x? I have Ubuntu 16.04. Should I uninstall older version and install new one? If so, how can I do this.
A tried
sudo n latest
but it says
sudo: n: command not found
and when i just
n latest
is requires sudo
Wtf?
Use Node version manager:
For development systems you may test different versions so you may want to switch between versions on demand. This is possible using the nvm version manager. This allows you to try out your code in different versions and find problems.
Install it using the script:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
Then you may directly use it. It can install other versions and switch between versions easily.
Some of the commands are:
nvm current display currently activated version
nvm ls [<version>] list installed versions
nvm ls-remote [<version>] list versions available for install
nvm version <version> get best matching installed version
nvm version-remote <version> get best matching remote version
nvm install <version> download and install a version
nvm uninstall <version> uninstall a version
nvm use <version> modify path to use version
nvm which <version> show path there this version is installed
So to install node 8 call
$ nvm install 8
And to upgrade to new node version later:
$ nvm current
v8.0.0
$ nvm version-remote 8
v8.1.0
$ nvm install 8.1 --reinstall-packages-from=8.0
Downloading and installing node v8.1.0...
Downloading https://nodejs.org/dist/v8.1.0/node-v8.1.0-linux-x64.tar.xz...
######################################################################## 100,0%
Computing checksum with sha256sum
Checksums matched!
Now using node v8.1.0 (npm v5.0.3)
Reinstalling global packages from v8.0.0...
added 9 packages and updated 1 package in 2.463s
Linking global packages from v8.0.0...
But after you changed your node version you should call npm install in your module again.
Use this command for ubuntu
sudo npm install npm#latest -g
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
//for latest release
`sudo n latest
You have something called nvm (Node Version Manager)
To see all versions of node/nodejs type in terminal: "node ls-remote"
to install a specific version type in terminal: "nvm install 10.15.2" (for version 10.15.2 as an example)

Resources