运行npm install
时出现错误。来自debug.log的日志如下:
2644 silly saveTree +-- webfontloader@1.6.28
2644 silly saveTree `-- zone.js@0.8.26
2645 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ories":{},"dist":{"in'
2645 verbose stack at JSON.parse (<anonymous>)
2645 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2645 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
2645 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
角度版本6.1.10
npm 6.4.1
节点10.10.0
Windows 10
package.json依赖项:
"@angular/animations": "6.1.10",
"@angular/cli": "~6.2.4",
"@angular/common": "6.1.10",
"@angular/compiler": "6.1.10",
"@angular/compiler-cli": "6.1.10",
"@angular/core": "6.1.10",
"@angular/forms": "6.1.10",
"@angular/http": "6.1.10",
"@angular/platform-browser": "6.1.10",
"@angular/platform-browser-dynamic": "6.1.10",
"@angular/router": "6.1.10",
"jest": "23.5.0",
任何使该工作正常进行的指针都将受到赞赏。
答案 0 :(得分:0)
解决方法是清理npm-cache:
我必须清理我的npm缓存,删除现有的npm-cache目录
来自C:\Users\username\AppData\Roaming
。
运行
npm cache clean --force
我还必须设置npm config来使用http
来代替https
。
npm install
以安装项目依赖项。