【问题标题】:Can't create a Project with Angular CLI无法使用 Angular CLI 创建项目
【发布时间】:2018-12-01 02:44:46
【问题描述】:

几天前,我用 Angular CLI 创建了一个新项目,一切正常。我现在无法创建任何新项目。下面是cmd中的错误日志:

 c:\Users\Jesper\Desktop>ng new mytestapp
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE mytestapp/angular.json (3795 bytes)
CREATE mytestapp/package.json (1316 bytes)
CREATE mytestapp/README.md (1026 bytes)
CREATE mytestapp/tsconfig.json (408 bytes)
CREATE mytestapp/tslint.json (2837 bytes)
CREATE mytestapp/.editorconfig (245 bytes)
CREATE mytestapp/.gitignore (503 bytes)
CREATE mytestapp/src/favicon.ico (5430 bytes)
CREATE mytestapp/src/index.html (296 bytes)
CREATE mytestapp/src/main.ts (372 bytes)
CREATE mytestapp/src/polyfills.ts (3234 bytes)
CREATE mytestapp/src/test.ts (642 bytes)
CREATE mytestapp/src/styles.css (80 bytes)
CREATE mytestapp/src/browserslist (388 bytes)
CREATE mytestapp/src/karma.conf.js (964 bytes)
CREATE mytestapp/src/tsconfig.app.json (166 bytes)
CREATE mytestapp/src/tsconfig.spec.json (256 bytes)
CREATE mytestapp/src/tslint.json (314 bytes)
CREATE mytestapp/src/assets/.gitkeep (0 bytes)
CREATE mytestapp/src/environments/environment.prod.ts (51 bytes)
CREATE mytestapp/src/environments/environment.ts (662 bytes)
CREATE mytestapp/src/app/app-routing.module.ts (245 bytes)
CREATE mytestapp/src/app/app.module.ts (393 bytes)
CREATE mytestapp/src/app/app.component.html (1173 bytes)
CREATE mytestapp/src/app/app.component.spec.ts (1104 bytes)
CREATE mytestapp/src/app/app.component.ts (213 bytes)
CREATE mytestapp/src/app/app.component.css (0 bytes)
CREATE mytestapp/e2e/protractor.conf.js (752 bytes)
CREATE mytestapp/e2e/tsconfig.e2e.json (213 bytes)
CREATE mytestapp/e2e/src/app.e2e-spec.ts (305 bytes)
CREATE mytestapp/e2e/src/app.po.ts (208 bytes)
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @schematics/update@0.10.5
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of '@angular/cli'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Jesper\AppData\Roaming\npm-cache\_logs\2018-11-09T00_31_49_304Z-debug.log
Package install failed, see above.

这是ng version的输出:

Angular CLI: 7.0.4
Node: 10.13.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.10.4
@angular-devkit/core         7.0.4
@angular-devkit/schematics   7.0.4
@schematics/angular          7.0.4
@schematics/update           0.10.4
rxjs                         6.3.3
typescript                   3.1.3

这个问题是怎么突然出现的,我该如何解决?

【问题讨论】:

  • 是否全局安装了angular-cli?
  • @Kai 我在 cmd 中输入了npm list -g,我在列表中找到了@angular/cli@7.0.4,所以看起来是这样的?
  • 您所在的文件夹(桌面)中是否有 package.json 或其他 Angular 文件?
  • @DeborahK node_modules 文件夹位于 C:\Users\Jesper\AppData\Roaming\npm\node_modules。这个文件夹里面没有package.json,但是@angular/cli/package.json有一个。

标签: angular angular-cli


【解决方案1】:

我刚刚遇到了类似的问题,只是在我的情况下,该过程在循环下载后冻结。我杀死它并再次运行它,它工作正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-06
    • 2017-08-14
    • 1970-01-01
    • 1970-01-01
    • 2017-08-07
    • 2017-10-25
    • 2019-12-07
    相关资源
    最近更新 更多