Sundar
Sundar

Reputation: 165

Latest compatible version for NPM and node

I am using nodist version 0.8.8 which is the latest one. By using this I installed latest node version 10.7.0 and latest NPM version 6.1.0. I assured it by reading the following document.

https://nodejs.org/en/download/releases/

Nw I surfed in Google to find whether NPM 6.2.0 is available? If it is I want to know the corresponding node version for it.

Upvotes: 16

Views: 97494

Answers (4)

Andrea Montalbani
Andrea Montalbani

Reputation: 89

For completeness: for anyone trying to install either node or npm via local .rpm packages in an air gapped machine (like me) you can reconstruct the dependency via by looking at the rpm name, e.g.:

npm-6.14.14-1.14.17.5.1.module_el8.4.0+943+c5e11f0f.x86_64.rpm

Where 6.14.14 is the npm version and 14.17.5 is the compatible node version

Bear in mind that this dependency is stricter than the real compatibility between npm and node but must be satisfied to install via rpm.

Upvotes: 0

Estus Flask
Estus Flask

Reputation: 222220

Node.js and NPM versions aren't directly connected, otherwise they would have matching versions.

Semantic versioning assumes that minor versions don't introduce breaking changes:

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,

MINOR version when you add functionality in a backwards-compatible manner, and

PATCH version when you make backwards-compatible bug fixes.

This means that if NPM 6.1.0 works with Node 10.7.0, NPM 6.2.0 works with it, too.

Node version requirements are usually listed in package.json engines section, which can be checked locally or in GitHub repository.

npm package.json doesn't contain this section, so actual Node version that is suitable for it has to be deduced.

npm code base currently uses ES6 but no higher. Latest Node 6 release covers 99% of ES6 spec, it's expected that NPM 6.2.0 is fully workable with Node 6.14 or higher. Generally, it's certain that latest even major version (Node 10, as of now) doesn't have problems with latest NPM release.

Upvotes: 4

Armin Ayari
Armin Ayari

Reputation: 619

You can use nvm which is node version manager

With nvm you have the option to install the latest npm compatible with your currently installed node

use this link to install nvm:

https://github.com/creationix/nvm

Upvotes: 5

Dhananjai Pai
Dhananjai Pai

Reputation: 6015

Node and npm are independent tools. You can very well install different versions of either. Use

npm i -g npm@latest

to get the latest npm installed with your node.

use node -v and npm -v to get respective version informations.

Upvotes: 0

Related Questions