npm install 报错,无法打包

npm install 报错,无法打包


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,具体操作
npm install 报错,无法打包

2、删除C:\Users\lenovo\AppData\Roaming下边的npm、npm-cache具体操作如下:
尤其是此步骤,不可省略,个人感觉这个才是解决问题的关键
npm install 报错,无法打包
3、重新安装node.js,再次在dos中输入node -v和npm -v可以看到相应的版本号。
下载node官网
node和npm版本的对应号

npm install -g cnpm --registry=http://registry.npm.taobao.org

npm安装任何包都报错的解决办法


**** 解决办法:****

1、执行:
npm config get proxy
npm config get https-proxy
如果返回值为null,继续执行:
(这一步很重要,一定要保证两个命令的返回值都为null,话说回来,应该出现这个错误这两个返回值有不为null的)
npm config set proxy null
npm config set https-proxy null

2、执行:
npm config set registry http://registry.cnpmjs.org/


然后就可以使用了
npm install -g cnpm --registry=https://registry.npm.taobao.org 
上一篇:chaoswise-scripts: command not found


下一篇:Docker:第七章:Docker搭建私服-本地镜像库,成功入职头条月薪35K