I was following some tutorial that was recorded a while ago, and it said for us to downgrade our npm version to 5.5.1 to avoid any differences (since that was the newest version at the time of the recording). So I did, using classic
npm install -g npm@5.5.1
However, now I'm stuck, I can't update to the actual present day latest version. I tried npm install -g npm@latest
, I tried manually typing the latest version, I even tried uninstalling both Node and NPM, and installing the latest ones, fresh from the site, but for whatever reason my npm just gets stuck on 5.5.1 again. How do I fix this?
I'm using Windows btw. Also, I'm just learning about Node and NPM, so I guess there is a chance I'm missing some obvious solution?
Edit: whenever I try to install something, I get the following
npm WARN npm npm does not support Node.js v12.18.3 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, npm WARN npm You can find the latest version at https://nodejs.org/ WARNING: You are likely using a version of node-tar or npm that is incompa with this version of Node.js. Please use either the version of npm that is bundled with Node.js, or a ve of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with s 9 and above.
and after that a long list of errors, including, but not limited to
1: 000000013F8A5EBF napi_wrap+114095 2: 000000013F850B46 v8::base::CPU::has_sse+66998 3: 000000013F850EC1 v8::base::CPU::has_sse+67889 4: 000000013F78F187 RSA_meth_get_flags+85639 5: 000000014001AAE0 v8::internal::Builtins::builtin_handle+323456
在您的项目根目录中,运行更新命令:
npm update
try this Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
refer to this https://www.npmjs.com/package/npm-windows-upgrade or their GitHub repo for more help
if it doesn't help, try this
uninstall node (Settings -> Add or remove programs)
, then navigate to C:\\Users\\{User}\\AppData\\Roaming
and delete the npm and npm-cache folder and finally install node again (using the installer).
You are missing the -g
. You said:
I tried
npm install npm@latest
but that that doesn't include the -g
. The -g
is key because it causes npm
to be installed globally (best rhyme). See Downloading and installing packages globally . Your first command includes it, but not the follow up.
Because of this, you probably install npm
as a local dependency (which you probably didn't mean to do). Check your package.json
and see if there is any listing of npm
. If you aren't directly using runtime pieces of npm
, remove that dependency and just install the specific version you want globally with -g
.
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.