Angular CLI停止创建新项目,没有任何错误

时间:2018-09-29 03:22:28

标签: angular angular-cli angular6

我正在尝试使用angular cli创建一个新项目,但是它似乎卡在提取过程中,并且不会产生任何错误:

D:\Angular6Sample\Angular6Sample>ng new angular6web --skip-git --skip-tests
CREATE angular6web/angular.json (4127 bytes)
...
CREATE angular6web/e2e/src/app.e2e-spec.ts (307 bytes)
CREATE angular6web/e2e/src/app.po.ts (208 bytes)
[            ......] \ extract:@angular/compiler: sill extract @angular/compiler@^6.1.0 extracted to D:\Angular6Sample\Angular6Sample\angular6web\node_modules\.stagin

然后我打开一个新的cmd窗口并尝试创建一个新项目,它告诉我它已经存在:

D:\Angular6Sample\Angular6Sample>ng new angular6web --skip-git --skip-tests
ERROR! angular6web/angular.json already exists.
...
ERROR! angular6web/e2e/src/app.po.ts already exists.
The Schematic workflow failed. See above.

D:\Angular6Sample\Angular6Sample>

所以我认为我的项目已经创建,但是在第一个cmd窗口中无法正确响应,所以我尝试构建它:

D:\Angular6Sample\Angular6Sample>cd angular6web

D:\Angular6Sample\Angular6Sample\angular6web>ng build
Could not find module "@angular-devkit/build-angular" from "D:\\Angular6Sample\\Angular6Sample\\angular6web".
Error: Could not find module "@angular-devkit/build-angular" from "D:\\Angular6Sample\\Angular6Sample\\angular6web".
    at Object.resolve (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:141:11)
    at Observable.rxjs_1.Observable [as _subscribe] (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\src\architect.js:132:40)
    at Observable._trySubscribe (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:43:25)
    at Observable.subscribe (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:29:22)
    at DoOperator.call (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\tap.js:29:23)
    at Observable.subscribe (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:24:22)
    at C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeTo.js:22:31
    at Object.subscribeToResult (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeToResult.js:7:45)
    at MergeMapSubscriber._innerSub (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:75:38)
    at MergeMapSubscriber._tryNext (C:\Users\Prashant\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:72:14)

D:\Angular6Sample\Angular6Sample\angular6web>

我想念什么?

2 个答案:

答案 0 :(得分:0)

尝试安装

npm install --save-dev @angular-devkit/build-angular

答案 1 :(得分:0)

  1. cd "your app name"
  2. npm install
  3. ng serve

那没有用:

npm install @angular-devkit/build-angular

https://github.com/angular/angular-cli/issues/10661