【发布时间】:2020-10-13 23:59:43
【问题描述】:
我已经安装了最新版本的 node.js 版本 10.16.3 和最新版本的 npm 版本 6.9.0
我目前正在学习关于 node.js 的课程,讲师建议降级到 npm 版本 5.5.1 以便与他的课程版本相同,所以我这样做了。
现在最新版本的 node.js 不支持 5.5.1 版本,如果我尝试运行任何 npm 命令,包括全局更新版本,它会引发相同的错误,如下所示。
我已经尝试了以下方法:
运行 npm i -g npm@latest 会引发与以下相同的错误。基本上任何 npm 命令都会抛出该错误
完全卸载并重新安装 node.js 但是 npm 的版本仍然是 5.5.1 而不是最新的
这是我在运行任何 npm 命令时收到的错误消息
npm WARN npm npm does not support Node.js v10.16.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, 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[5864]: c:\ws\src\node_zlib.cc:551: Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.
1: 00007FF7DC7ADD8A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
2: 00007FF7DC788886 node::MakeCallback+4534
3: 00007FF7DC78893F node::MakeCallback+4719
4: 00007FF7DC6E791D RSA_meth_get_flags+93021
5: 00007FF7DCCB5BF2 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+79442
6: 00007FF7DCCB707D std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+84701
7: 00007FF7DCCB60D6 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80694
8: 00007FF7DCCB5FBB std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80411
9: 000001F722E5C5C1
【问题讨论】: