最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - NPM is known not to run on Node.js v9.2.1 - Stack Overflow

programmeradmin0浏览0评论

Why I use NPM to install something, it will have this problem as below

ERROR: npm is known not to run on Node.js v9.2.1 Node.js 9 is supported but the specific version you're running has a bug known to break npm. Please update to at least 9.0.0 to use this version of npm. You can find the latest release of Node.js at /

Then I find some solutions at Stack Overflow.

npm WARN npm npm does not support Node.js v9.1.0

npm does not support Node.js v9.0.0

Almost every answer suggest to use npm uninstall -g npm first. But when I use this command, it will have the same error as above.

My npm version is 6.13.7

My node version is 9.2.

Why I use NPM to install something, it will have this problem as below

ERROR: npm is known not to run on Node.js v9.2.1 Node.js 9 is supported but the specific version you're running has a bug known to break npm. Please update to at least 9.0.0 to use this version of npm. You can find the latest release of Node.js at https://nodejs.org/

Then I find some solutions at Stack Overflow.

npm WARN npm npm does not support Node.js v9.1.0

npm does not support Node.js v9.0.0

Almost every answer suggest to use npm uninstall -g npm first. But when I use this command, it will have the same error as above.

My npm version is 6.13.7

My node version is 9.2.

Share Improve this question edited May 4, 2023 at 21:38 InSync 10.5k4 gold badges15 silver badges51 bronze badges asked Feb 3, 2020 at 7:56 JackieWillenJackieWillen 7492 gold badges13 silver badges25 bronze badges 2
  • And upgrading your node version is not an option? Because I think that would be the best thing to do otherwise – daanvanham Commented Feb 3, 2020 at 7:58
  • 6 You shouldn't be using Node 9 at all at this point, and if you're not in a position to be confidently upgrading should probably not have been using an odd-numbered, non-LTS version: nodejs.org/en/about/releases – jonrsharpe Commented Feb 3, 2020 at 8:01
Add a comment  | 

4 Answers 4

Reset to default 2

Basically node js 9.2... version is compatible with npm version 5.5.1. So I will provide you the following suggestion.

  1. if you want to work with node js 9.2 only then

    1. uninstall node js 9.2
    2. uninstall npm
    3. install node js 9.2
    4. then install npm version 5.5.1 - npm install -g [email protected]
  2. update node js and npm to the latest version and check your code compatibility with the new version.

To do this

  1. install node js latest version
  2. npm install -g npm@latest

In short, you accidentally upgrade npm, Node v9.2.0 using npm v5.5.1 as default,

while the default npm v6.13.7 of node is node v13.10.0.

In order to use Node v9.2.0 again, just use below code on your terminal:

cd ~ && nvm install v13.10.0
nvm uninstall v9.2.0
nvm install v9.2.0
nvm uninstall v13.10.0

END!

Others, a long long book about this question(GitHub Gist).

I had the same problem, I use nvm for managing the node versions.

Previously I had these versions installed:

  • NVM -> 1.1.7
  • Node.js -> 14.18.3
  • NPM -> 6.14.15

Then upgraded to these versions:

  • NVM -> 1.1.7 (still same)
  • Node.js -> 18.16.0
  • NPM -> 9.5.1

System: Windows

The installation was successful and verified by the node --version & npm --version commands.

But then, the npm commands started failing showing the same error. I tried some ways like updating node and npm separately, re-installing everything, etc. but the issue was still there.

Finally, after some investigation I found that my nvm version was pretty old at 1.1.7 and I tried updating the nvm version to the latest at 1.1.11 and then everything started working as expected with upgraded Node.js and NPM versions. Done!!

You can download the latest nvm(for Windows only) from here.

You can see the Node.js & NPM compatible versions here.

P.S.: The nvm every time installs the compatible versions of Node.js and NPM for every version.

  1. Delete manually directory npm and npm-cache in ... AppData/Roaming

  2. Run in your terminal npm cache clean --force

  3. Install your package npm install -g cordova ionic

发布评论

评论列表(0)

  1. 暂无评论