在新项目进行npm install时发生的错误,网上的解决方法有两种:
降级:npm install -g npm@5.4.0
升级:npm install -g npm
首先升级,升级后依然报错,故降级,降级后出现这个错误:
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.\staging-
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[15592]: src\node_zlib.cc:436: Assertion `args.Length() == 7 && “init(windowBits, level, memLevel, strategy, writeResult, writeCallback,” " dictionary)"’ failed.
1: 00007FF700D79055
2: 00007FF700D52FE6
3: 00007FF700D530B1
4: 00007FF700CC541C
5: 00007FF70136B022
6: 00007FF70136C4CD
7: 00007FF70136B559
8: 00007FF70136B43B
9: 000002C0D18841C1
原来是node.js的问题,看来要重装node.js了,
首先uninstall npm:
npm uninstall -g npm
接着去这个网站重装nodejs:
https://nodejs.org
最后重装npm:
npm install -g npm
再npm install, 就可以了。
此时报错:
npm WARN angular-esri-components@1.0.3 requires a peer of @angular/common@^2.3.1 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-esri-components@1.0.3 requires a peer of @angular/core@^2.3.1 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-esri-loader@1.1.1 requires a peer of @angular/core@^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN angular-esri-loader@1.1.1 requires a peer of rxjs@^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.1.3 requires a peer of popper.js@^1.14.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
audited 21840 packages in 25.795s
found 15 vulnerabilities (9 low, 6 high)
run npm audit fix
to fix them, or npm audit
for details
我们运行npm audit fix --force
还是报错(警告):
npm WARN angular-esri-components@1.0.3 requires a peer of @angular/common@^2.3.1 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-esri-components@1.0.3 requires a peer of @angular/core@^2.3.1 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-esri-loader@1.1.1 requires a peer of @angular/core@^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN angular-esri-loader@1.1.1 requires a peer of rxjs@^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.1.3 requires a peer of popper.js@^1.14.3 but none is installed. You must install peer dependencies yourself.
此时运行:
npm install -g npm-install-peers