简体   繁体   English

无法将 NPM 更新到其最新版本

[英]Can't Update NPM to its Latest Version

Following a certain tutorial, I downgraded my npm from 6.14.1 to version 5.5.1 .按照某个教程,我将我的 npm 从6.14.1降级到版本 5.5.1 But every time I install a package using npm, it doesn't work anymore and got compatibility issues already.但是每次我使用 npm 安装 package 时,它都不再起作用并且已经出现了兼容性问题。 It says:它说:

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

I already installed the latest version of node.js which is v14.6.0 but still I got the same issues.我已经安装了最新版本的 node.js,它是v14.6.0 ,但我仍然遇到了同样的问题。 I tried using npm i -g npm@latest to update my npm but still didn't work.我尝试使用npm i -g npm@latest来更新我的 npm 但仍然没有用。 I also tried npm install -g npm-windows-upgrade but I only get these errors:我也试过npm install -g npm-windows-upgrade但我只得到这些错误:

npm WARN npm npm does not support Node.js v14.6.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/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
npm[20932]: c:\ws\src\node_zlib.cc:573: Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.
 1: 00007FF67312FF3F napi_wrap+110015
 2: 00007FF6730D5F36 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap,2>::NumberOfElementsOffset+33350
 3: 00007FF6730D62B1 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap,2>::NumberOfElementsOffset+34241
 4: 00007FF67300E52A v8::internal::Isolate::isolate_root_bias+77290
 5: 00007FF67393690F v8::internal::Builtins::builtin_handle+321503
 6: 00007FF673935E9E v8::internal::Builtins::builtin_handle+318830
 7: 00007FF673936197 v8::internal::Builtins::builtin_handle+319591
 8: 00007FF673935FE3 v8::internal::Builtins::builtin_handle+319155
 9: 00007FF673A1260D v8::internal::SetupIsolateDelegate::SetupHeap+464173
10: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
11: 00007FF6739A6CFA v8::internal::SetupIsolateDelegate::SetupHeap+23578
12: 00007FF673A909B3 v8::internal::SetupIsolateDelegate::SetupHeap+981203
13: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
14: 00007FF6739A4B49 v8::internal::SetupIsolateDelegate::SetupHeap+14953
15: 00007FF6739A6CD1 v8::internal::SetupIsolateDelegate::SetupHeap+23537
16: 00007FF673A909B3 v8::internal::SetupIsolateDelegate::SetupHeap+981203
17: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
18: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
19: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
20: 00007FF6739A4B49 v8::internal::SetupIsolateDelegate::SetupHeap+14953
21: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
22: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
23: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
24: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
25: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
26: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
27: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
28: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
29: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
30: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
31: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
32: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
33: 00007FF6739A4B49 v8::internal::SetupIsolateDelegate::SetupHeap+14953
34: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
35: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
36: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
37: 00007FF6739AAF12 v8::internal::SetupIsolateDelegate::SetupHeap+40498
38: 00007FF6739A8BCE v8::internal::SetupIsolateDelegate::SetupHeap+31470
39: 00007FF6739A87BC v8::internal::SetupIsolateDelegate::SetupHeap+30428
40: 00007FF67388CB19 v8::internal::Execution::CallWasm+1657
41: 00007FF67388C37F v8::internal::Execution::Call+191
42: 00007FF673963B77 v8::Function::Call+615
43: 00007FF67315365D node::CallbackScope::~CallbackScope+861
44: 00007FF67315399B node::CallbackScope::~CallbackScope+1691
45: 00007FF673153E81 node::MakeCallback+209
46: 00007FF67311EB6E napi_wrap+39406
47: 00007FF6731789C8 uv_check_init+120

Can someone help me please.有人能帮助我吗。 Thank you!谢谢!

Check this out.看看这个 The npm windows upgrade tool automates the whole process. npm windows升级工具使整个过程自动化。 npm-windows-upgrade --npm-version latest and the tool will show you a list of the lastest and available versions of npm. npm-windows-upgrade --npm-version latest并且该工具将向您显示 npm 的最新和可用版本的列表。 Choose the one you want to install and it will do the rest.选择您要安装的那个,它将执行 rest。

I found an answer from a thread of people who encountered the same issue as mine and it worked for me.我从一群遇到与我相同问题的人那里找到了答案,它对我有用。 I simply installed Node Version Manager from github and run cmd as administrator then did nvm install latest and nvm use .我只是从 github 安装了Node Version Manager并以管理员身份运行 cmd 然后nvm install latestnvm use Now, everything works fine as before.现在,一切都像以前一样正常。

Here's the link for the complete guide of NVM installation: NVM for Windows这是 NVM 安装完整指南的链接: NVM for Windows

I found I was running a react application in another window.我发现我正在另一个 window 中运行一个反应应用程序。 I trying to update node js with this was running.我试图用这个来更新节点 js 正在运行。 When I stopped it running, uninstalled and reinstalled, this error stopped for me.当我停止它运行、卸载并重新安装时,这个错误对我来说停止了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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