npm install 报错踩坑路,npm报错以及卸载node,npm和node版本不符合
程序员文章站
2022-03-16 11:25:03
...
npm install 报错踩坑路
先出现的是超过最大调用栈问题:
npm ERR! Maximum call stack size exceeded
百度之后说给npm降级或者升级
降级 : npm install -g aaa@qq.com
升级 : npm install -g npm 升级到最新版
结果降级之后再尝试的时候就直接报版本跟node.js不兼容的问题,然后各种在升级都不好使,只能重新删掉在升级
**
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\lenovo\AppData\Roaming下边的npm、npm-cache具体操作如下:
尤其是此步骤,不可省略,个人感觉这个才是解决问题的关键
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