Friday, March 9, 2018

NVM or N or Something else to upgrade Node.js?

Leave a Comment

The information on stackoverflow and elsewhere about these seems pretty old. In the past either NVM or N seemed to be just as useful for upgrading Node but does that still apply today or is one or something else better than the other?

It is hard to try get a comparison doing my own research as "N" is impossible to search on.

2 Answers

Answers 1

If you're using Windows, to update, all you need to do is run the new installer. This will overwrite the previous installation. If you're running Linux, then it's a bit more complicated.

Regularly, uninstalling Node would be locating the directory of Node, then deleting the entire thing. Then you'd have to recompile Node, which is inconvenient and consumes more time. That's why n and nvm were created. n is a Node module, which can be installed by npm, and nvm is a Bash script.

n and nvm are both still active projects, because it's still more of a bother than updating on Windows. They are still actively maintained, and both have been modified less than 10 days ago.

I find n to be of easier use because it can be installed by npm, but both scripts serve their purpose.

To install n, which is created by the same developer as Express, use this:

npm install -g n 

Note that the -g flag means to install globally. You need it to run it on the command line. Then use:

n 0.10.0 

To install version 0.10.0 of Node:

Usage: n [options] [COMMAND] [config]  Commands:    n                            Output versions installed   n latest [config ...]        Install or activate the latest node release   n stable [config ...]        Install or activate the latest stable node release   n <version> [config ...]     Install and/or use node <version>   n use <version> [args ...]   Execute node <version> with [args ...]   n bin <version>              Output bin path for <version>   n rm <version ...>           Remove the given version(s)   n --latest                   Output the latest node version available   n --stable                   Output the latest stable node version available   n ls                         Output the versions of node available  Options:    -V, --version   Output current version of n   -h, --help      Display help information  Aliases:    which   bin   use     as   list    ls   -       rm 

Answers 2

If you don't need Windows support, Nave is another good option. It's from isaacs, who runs Node now.

https://github.com/isaacs/nave

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment