简体   繁体   中英

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 . But every time I install a package using npm, it doesn't work anymore and got compatibility issues already. 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. I tried using npm i -g npm@latest to update my npm but still didn't work. I also tried npm install -g npm-windows-upgrade but I only get these errors:

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-upgrade --npm-version latest and the tool will show you a list of the lastest and available versions of npm. Choose the one you want to install and it will do the 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 . Now, everything works fine as before.

Here's the link for the complete guide of NVM installation: NVM for Windows

I found I was running a react application in another window. I trying to update node js with this was running. When I stopped it running, uninstalled and reinstalled, this error stopped for me.

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