在Angular中创建新项目时,npm引发错误 [英] npm throws error when create new project in Angular

查看:362
本文介绍了在Angular中创建新项目时,npm引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用ng new命令使用Git Bash控制台创建新的Angular项目时发生错误.我之前创建了项目,但从未发生过此问题.这是调试日志的链接 https://drive.google.com/open?id=10ddECHas5LA2mxmOd7g6ItgX8pNb 和使用控制台 https://drive.google.com/open?id= 1zahCD8q2FcXirlhO0cPqSjZOjXRqBLqx 我们将不胜感激.

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

推荐答案

我遇到了类似的问题.清除npm缓存后即可解决.

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

npm cache clean --force

这篇关于在Angular中创建新项目时,npm引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆