NodeJS can't install it properly - node.js

I had problem with create-react-app and turned out I gotta update my version of nodeJS. The thing is that I can't do so. when I type node --version I get v11.10.0, however when I type sudo n stable, I get:installed : v10.16.3 (with npm 6.9.0).
However when checking version of node I all time get this 11.10.0. How can I get this last stable version 10.16.3?
EDIT: SOLVED
turned out nvm was installed on laptop and it controled node version

I would suggest you use nvm to manage your node versions. It allows you to download multiple versions and you can assign versions on a per project basis. It also allows you to choose which version you want as default

Install nvm it will allow you to install and use any version you want.
Installation steps on ubuntu 18.04

Related

Downgrade Node Js version

I want to downgrade the NodeJs version to 16 as some of the dependencies I am using in my React app do not support NodeJs 17. I tried this method (another post on stack overflow) also but this thing is not getting installed on my PC.
OS: Windows
Any sort of help is appreciated.
Thanks in advance.
You can use Node Version Manager(NVM).where you can downgrade or upgrade any node version. Please check
https://github.com/nvm-sh/nvm
Windows:
https://dev.to/skaytech/how-to-install-node-version-manager-nvm-for-windows-10-4nbi
Ubuntu:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
Clearing the local installation of node, to find out where is and delete
where node
Install nvm
For Windows
For others
Show all the versions
nvm ls available
Install what you want
nvm install 16.11.0
nvm use 16.11.0
Check node version
node -v
I have tried several ways and this works, hope it helps.
2022 update with examples
Install nvm (See link readme: Windows uses installer, Linux has a CLI copy+paste bash script).
Restart the shell (if it was open when installed) to register the new path.
If you want 14.18.1, for example: nvm use 14.18.1
If you don't have it installed, it'll let you know. In that case: nvm install 14.8.1 -> repeat #3.
node -v to verify.
Nodejs.org has previous releases versions in their distribution directory. Find the node version you need and install it.
https://nodejs.org/dist/
n is the simplest package to manage your node versions.
https://www.npmjs.com/package/n

Unable to downgrade Node to specific version

I am building a sample application in which I need to use Node Version v9.11.2 and npm 4.0.0. Currently I have Node Version v16.4.0 installed on my system. I tried to install the specific version by uninstalling the latest version and installing version 9.11.2 from official website
Problem: The problem is I can uninstall the latest version without any problem but when I try to install older version(9.11.2) the command gets opened and it does nothing. I also tried to install the older version using cli commands ie. npm install -g node#9.11.2, it installs the version but on checking the version using node -v, it still shows the latest version(16.4.0)
Below are the screenshots for better understanding
Installed version 9.11.2 but showing 16.4.0
Any Solution please ?
Is using docker a possibility? If so you can simply get a docker image of the required version and use if from there.
Another way is to use NVM which is a really useful tool to manage nodejs versions. I'm including their github repo for your convenience:
https://github.com/nvm-sh/nvm
A good option is to use NVM: https://github.com/coreybutler/nvm-windows (Windows) or https://github.com/nvm-sh/nvm (unix, macOS). With NVM you can enable different versions of node on the same machine and switch from one to another, usually it takes care of managing the installed packages and adding them to its own management system.

How do I know which version of node.js I am currently running?

I remember I have upgraded to node.js v8.0.0.
And when I type node --version I see version number is v8.0.0.
However when I use which node on my OS X I see the path is /usr/local/Cellar/node/7.7.1/bin/node. Why would that happen? Am I using v8.0.0?
How did you install node?
Seems like you have used brew to install node in the past, but then upgraded in some other way.
In any case, you should trust the node --version, since this is node itself reporting.
If still in doubt, I would remove and reinstall.
Sounds like you have installed one version with Homebrew and one by normal installer?
Depending on your setup you can either remove the 7x version from Homebrew, or update and link to the correct version in Homebrew.
https://github.com/Homebrew/brew/blob/master/docs/FAQ.md#can-i-install-my-own-stuff-to-usrlocal

I installed node.js v5.12.0 but the version showing v0.12.2

I installed Node.js from (https://nodejs.org/dist/latest-v5.x/node-v5.12.0-x64.msi), but the issue is , its showing version v0.12.2 instead of v5.12.0 which is required.
I try to update the node.js 5.2 installer but still showing version v0.12.2.
I have uninstalled Node.js and reinstall node-v5.12.0-x64.msi but still it’s not updated. Due to this am not able to run further commands for Ionic environmental setup.
Open a terminal and type where node
It should point to an old version of node (v0.12.2) still installed on your computer, for example C:\bin\node.
As Node.js is portable, you can have multiple versions on your computer.
If it cannot be uninstalled, simply delete C:\bin\node folder.
Then:
Open Windows System Properties/Advanced system properties
Click on Environment variables and edit PATH variable
Remove inside its value the path of the old version of node (C:\bin\node in our example).
Re-install Node v5.
Close your terminal and open a new one then type where node, it should point to Node.js v5
Most likely, you have an old Node version for x86 platform, and you are installing a newer version for 64 bit. Remove the path to the x86 from the Paths env variable, or move it to after the 64 bit path.
Solution:
List node.js installatios using nvm:
nvm ls
High chance the version you tried to install is also listed
Select the version to use using nvm
nvm use
(Not a direct solution)
You can try to install using nvm
Uninstall nodejs and follow the instruction from https://github.com/coreybutler/nvm-windows

How to backup my Node.js setup when upgrading

I want to upgrade Node.js on Ubuntu, but I want to make sure that if anything goes wrong I could revert back my source code, installed modules and node binary to the working setup. How to achieve that?
You can install any version of node.js just go to downloads. Go into Other Releases and download what version you want with respect to your OS and 32-bit or 64-bit.
Example:
node-vX.XX.X-OS-x64.tar.gz (64-bit)
node-vX.XX.X-OS-x86.tar.gz (32-bit)
Then, follow the instruction on the github.com. Building and installing Node.js
Another way is to use NVM, the Node Version Manager (it works in a very similar way to rvm for ruby). This allows to install and manage multiple versions of node. Here's a snippet (source):
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
You can also check this n. A Simple flavour of node binary management.
Update (as per comments):
If you have installed the nvm after node.js. You can check already installed by using nvm ls which lists already installed version(s) ready to use.
amolkulkarni#ubuntu:~$ nvm ls
current: v0.10.18
You should use Node Version Manager https://github.com/creationix/nvm

Resources