npm报错以及卸载node

C:\Users\Administrator\Desktop\vue>npm install
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.ocks\staging-a3dd59b508ab06e6.lock for C:\Users\Administrator\Deskto
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[10728]: c:\ws\src\node_zlib.cc:460: Assertion `args.Length() == 7 && “init(windowBits, level, memLevel, strategy, writeResult, writeCallback,” " dictionary)"’ failed.

1: 000000013F49F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
2: 000000013F47A0C6 node::MakeCallback+4518
3: 000000013F47A17F node::MakeCallback+4703
4: 000000013F3DF179 v8::internal::LookupIterator::index+93209
5: 000000013FC7C122 v8::internal::OptimizingCompileDispatcher::Unblock+59890
6: 000000013FC7D5AD v8::internal::OptimizingCompileDispatcher::Unblock+65149
7: 000000013FC7C606 v8::internal::OptimizingCompileDispatcher::Unblock+61142
8: 000000013FC7C4EB v8::internal::OptimizingCompileDispatcher::Unblock+60859
9: 000001CEBF65C5C1

解决方法如下
1、卸载node.js,具体操作:
在这里插入图片描述
2、删除C:\Users\Administrator\AppData\Roaming下边的npm、npm-cache具体操作如下:
尤其是此步骤,不可省略,个人感觉这个才是解决问题的关键
在这里插入图片描述
3、重新安装node.js,再次在dos中输入node -v和npm -v可以看到相应的版本号。
其他的疑难杂症也可以尝试用此方法解决

Logo

前往低代码交流专区

更多推荐