简体   繁体   中英

i have latest nodejs version installed,but i can't update npm as well (windows)

i updated my nodejs to the latest stable version v15.7.0.my npm version is now 5.5.1 I tried commands C:\Users\Asus>npm update -g and C:\Users\Asus>npm install -g npm@latest to updating npm .but i got this errors each time:

npm WARN npm npm does not support Node.js v15.7.0
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/
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Asus\AppData\Roaming\npm-cache\_logs\2021-01-28T11_03_53_376Z-debug.log

any idea how can i fix it?

As per https://nodejs.org/en/download/ (as per today), it is mentioned as Latest LTS Version: 14.15.4 (includes npm 6.14.10)

Since node installation includes NPM also, you don't need to install it separately.

so cleanest way is to uninstall node from your machine and install it freshly which automatically gets you compatible NPM

i found the solution: https://github.com/nodejs/help/issues/2874#issuecomment-663661148

i deleted npm and npm cache folders in Appdata>Roaming and then reinstalled nodejs

Open PowerShell as Administrator and execute following commands,

> Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
> npm install -g npm-windows-upgrade
> npm-windows-upgrade

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM