在Angular中创建新项目时,npm抛出错误

时间:2018-06-10 21:19:13

标签: angular npm

当我尝试使用ng new命令使用Git Bash控制台创建新的Angular项目时发生错误。我之前创建了项目,这个问题从未发生过。以下是调试日志https://drive.google.com/open?id=10ddECHas5LA2mxmOd7g6ItgX8pNbTj54的链接和控制台https://drive.google.com/open?id=1zahCD8q2FcXirlhO0cPqSjZOjXRqBLqx的屏幕截图。我们将非常感谢您的帮助。

$ ng new todo
installing ng
create .editorconfig
create README.md
create src\app\app.component.css
create src\app\app.component.html
create src\app\app.component.spec.ts
create src\app\app.component.ts
create src\app\app.module.ts
create src\assets\.gitkeep
create src\environments\environment.prod.ts
create src\environments\environment.ts
create src\favicon.ico
create src\index.html
create src\main.ts
create src\polyfills.ts
create src\styles.css
create src\test.ts
create src\tsconfig.app.json
create src\tsconfig.spec.json
create src\typings.d.ts
create .angular-cli.json
create e2e\app.e2e-spec.ts
create e2e\app.po.ts
create e2e\tsconfig.e2e.json
create .gitignore
create karma.conf.js
create package.json
create protractor.conf.js
create tsconfig.json
create tslint.json
Successfully initialized git.
Installing packages for tooling via npm.
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major 
version bump
npm ERR! Unexpected end of JSON input while parsing near 
'...int":"2.8.x","nock":"'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\dext3\AppData\Roaming\npm-cache\_logs\2018-06- 
11T00_36_20_835Z-debug.log

1 个答案:

答案 0 :(得分:2)

我遇到了类似的问题。清除npm缓存后解决了这个问题。

npm cache clean --force