Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I just installed node v9.11.1 when I try to use npm I keep getting the following error:

npm WARN npm npm does not support Node.js v9.11.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/

I tried to do npm i -g npm but it couldn't update itself, it just kept throwing the same error above.

When I run npm -v it says 5.5.1 it seems the latest version is currently 5.8.0.

I tried deleting the folder and running the repair function on the node.js installer, but it didn't replace the module.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
315 views
Welcome To Ask or Share your Answers For Others

1 Answer

Delete the Global NPM Folder

https://stackoverflow.com/a/5926706/349659

npm list -g

For Windows this will most likely be:

%AppData% pm ode_modules

You can paste that into a folder's address bar and it will take you there.

Once there delete the folder named npm.

Download the Latest Release of NPM

https://github.com/npm/cli/releases/latest

Grab the zip and unzip it to your node_modules folder that you just deleted the npm folder from.

Rename the folder you extracted from the zip to npm

If you get any warnings about the file path or name being too long skip the warnings.

Update for Good Luck

Now you should be able to run npm i -g npm to update/reinstall npm without any warnings.

I find this step especially important if you had errors in Windows about the path or file name being too long.

You may get the following errors. If you do go and delete or move the files it has listed and you should be able to run npm i -g npm successfully.

npm ERR! Refusing to delete C:Program Files
odejs
px.cmd: is outside C:Program Files
odejs
ode_modules
pm and not a link
npm ERR! File exists: C:Program Files
odejs
px.cmd
npm ERR! Move it away, and try again.

npm ERR! Refusing to delete C:Program Files
odejs
pm.cmd: is outside C:Program Files
odejs
ode_modules
pm and not a link
npm ERR! File exists: C:Program Files
odejs
pm.cmd
npm ERR! Move it away, and try again.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...