npm throws error when create new project in Angula

2019-03-07 05:42发布

问题:

An error occured when I tried to create a new Angular project using Git Bash console using ng new command. I created projects earlier and this problem never occured. Here is the link to debug log https://drive.google.com/open?id=10ddECHas5LA2mxmOd7g6ItgX8pNbTj54 and screenshot with console https://drive.google.com/open?id=1zahCD8q2FcXirlhO0cPqSjZOjXRqBLqx Your help will be appreciated.

$ 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:

I faced similar problem. It was solved after clearing npm cache.

npm cache clean --force


标签: angular npm