How to update nodejs
How to update nodejs
How to properly update Node js in windows?
I want to update my Node js to the current LTS version on my windows 7. Do I just let the current version be, and install the latest version from the website? Or do I need to delete the currently installed node? If so, how do I do that?
6 Answers 6
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
The best way to have multiple versions of Node is by using nvm.
Download the version you want, for instance msi for windows. Run the download and it will update the version to the one you have downloaded.
I believe that since npm installs Node.JS as a package (just like it would React or any other package) to your project, you can just ‘npm install node’ to get the latest version.
If you’re looking for npm, the NPM website says this:
To update your npm, type this into your terminal:
Follow https://phoenixnap.com/kb/update-node-js-version you can find several ways to update the node.
Install nvm by running:
Then run the editor as administrator :
nvm install 14.18.1 (example the node version that you want or use lts for the latest)
If you install the latest stable version. Please use the below comments with the administrator command prompt
Once complete the installation. You received the message
How to properly upgrade node using nvm
Is it possible to upgrade node right in place, instead of manually installing the latest stable version?
8 Answers 8
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
then, if you want, you can delete your previous version with:
Where, in your case, NEW_VERSION = 5.4 OLD_VERSION = 5.0
You can more simply run one of the following commands:
Latest version:
Stable (LTS) version: (if currently in use)
This will install the appropriate version and reinstall all packages from the currently used node version.
This saves you from manually handling the specific versions.
Kudos to @m4js7er for commenting about the LTS version.
⚡ TWO Simple Solutions:
To install the latest version of node and reinstall the old version packages just run the following command.
To install the latest lts (long term support) version of node and reinstall the old version packages just run the following command.
Here’s a GIF animation to support this answer:
if you have 4.2 and want to install 5.0.0 then
the answer of gabrielperales is right except that he missed the «=» sign at the end. if you don’t put the «=» sign then new node version will be installed but the packages won’t be installed.
Here are the steps that worked for me for Ubuntu OS and using nvm
Go to nodejs website and get the last LTS version (for example the version will be: x.y.z)
After that, execute nvm list and you will get list of node versions installed by nvm.
Now you need to switch to the default last installed one by executing:
Update: sometimes even if i go over the steps above it doesn’t work, so what i did was removing the symbolic links in /usr/local/bin
Node.JS to install a new version.
Step 1 : NVM Install
Step 2 : NODE Newest version install
nvm install *.*.*(NodeVersion)
Step 3 : Selected Node Version
nvm use *.*.*(NodeVersion)
Bash alias for updating current active version:
For Windows 11 this worked for me on cmd, used with admin rights:
Prerequisite, in case you just installed NVM, is to open a new cmd window after nvm installation.
You can check again if the change was successful using
If you want to use the LTS version, install using
How do I update npm on Windows?
When I install node 0.10.33 from the msi ( http://nodejs.org/download/ ), I get an old version of npm (1.4.28). How can I upgrade npm on Windows?
does not work; I still have the old npm.
13 Answers 13
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
To fix this, do one of these:
C:\Program Files (x86)\nodejs\npm
C:\Program Files (x86)\nodejs\npm.cmd
npm install npm@latest
*There is an npm package that automate this Option 3:
We at Microsoft Open Source wrote a small tool to automate the process outlined above. You can find it here or just install and run it by executing the following in an elevated command prompt / PowerShell:
+ CategoryInfo : ObjectNotFound: (npm-windows-upgrade:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
There May be many ways to update your npm in Windows
Way 1
Way 2
3.3.12 is my preferred version of npm that best suits for approximately every package.
So, TL;DR; this worked:
From a command prompt, run where npm
This is what worked for me (goofy me!) I had (age ago) installed npm via chocolatey, which created a chocolatey initiated npm.exe in C:\ProgramData\chocolatey\bin\npm.exe. This was npm version 1.4.9 and wouldn’t update no matter what one did including uninstall and reinstall NodeJs.
EDIT: Better way to install node and npm
As of today (27/06/2017), the best way to install and manage node and npm is to install nvm (Node Version Manager) as explained here: https://github.com/coreybutler/nvm-windows. Once you have nvm, installing any node version is super easy:
As far as I can tell, there are two options that seem to work reliably today.
This worked for me. The other option is:
You need to follow the Windows upgrade instructions
First, ensure that you can execute scripts on your system by running the following command from an elevated PowerShell. To run PowerShell as Administrator, click Start, search for PowerShell, right-click PowerShell and select Run as Administrator.
To upgrade NPM on windows 10
I did something similar to Sam Mikes. I’m only sharing this because I couldn’t get either of his solutions to work on my rig. After a bit of playing around, this is what worked for me:
Note: I’ve used the Microsoft automated script in the past to fix this, but only because I didn’t realize how easy it would be to do it myself.
So none of the previous answers solved the issue for me so I thought I would post my specific solution, which I managed to figure out by going through all the other answers so they were really helpful.
My issue was because I had used chocolatey to install node and possibly npm (looking at chocolatey site now I shouldn’t have done that).
To solve the issue I simply had to run the relevant choco uninstall commands for npm and node and then everything switched to the other version of node which I had also installed using the node msi (from node’s website).
I hope that helps anyone else that may have gone down the same path as me.
I tried almost every answer but none of them works my way.
Neither npm-windows-upgrade worked nor did the npm install npm@latest etc etc worked.
For people like me I will suggest you guys downloading the latest installer from Node.js website, let the existing version of node directory be on it’s place and without changing anything just install the msi installer and you will end up with an upgraded version of node.
My case was upgrading node from 6 to 8.9.3
all npm install commands were getting stuck and will throw error (behind proxy error) after sometime. setting up proxy was not helping. This is what I did.
Node.js is a cross-platform JavaScript environment that can be used for server-side scripting. Due to its non-blocking workflow, Node.js is popular among the web developers for building a dynamic web application. Node Package Manager also known as npm is the package manager for Node.js. It also serves as a command-line utility for interacting with the npm online repository for package installation, version management, and dependency management. It is important to have Node.js installed in order to use npm. Also, working with updated versions of Node.js and npm ensures better performance and added features.Stable version of Node.js can be downloaded or updated from the official Node.js website as well as through the command line using Node Version Manager(nvm). nvm was originally developed for Linux systems, however nvm can be installed separately for Windows system by the following steps:
After installing nvm, the following can be done to update Node.js to the latest version:
Check the list of available Node.js version in the system using the following command:
To use the desired version, use the following command:
Update npm: To update NPM, use the following command:
Output:
Below is a demonstration for updating Node.js and npm versions for Linux systems. Install nvm in Linux:
Check if nvm is installed successfully
To install latest version of node, use the following command.
Check all the available version of node on the system:
Use a particular version
Update npm to latest version:
JavaScript is best known for web page development but it is also used in a variety of non-browser environments. You can learn JavaScript from the ground up by following this JavaScript Tutorial and JavaScript Examples.
How can I update npm itself?
I am trying to update npm itself:
I get 1.4.28? How to upgrade the npm itself?
3 Answers 3
Trending sort
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Switch to Trending sort
By using this command you can update npm to the latest release by using npm itself :
You can try this:
npm install npm@latest
See which version you have
Install the newest npm update
Upgrade to the most recent release
Upgrading on Windows Microsoft wrote a small command-line tool to automate the steps below. You can go and download it here
Not the answer you’re looking for? Browse other questions tagged node.js windows npm or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источники информации:
- http://stackoverflow.com/questions/34810526/how-to-properly-upgrade-node-using-nvm
- http://stackoverflow.com/questions/26908899/how-do-i-update-npm-on-windows
- http://www.geeksforgeeks.org/how-to-update-node-js-and-npm-to-next-version/
- http://stackoverflow.com/questions/31290242/how-can-i-update-npm-itself