我尝试使用ng new project-name
安装一个新的角度启动器项目,但是每次我遇到以下错误代码时都会结束
PS H:\Desktop\cool-app> ng serve
Could not find module "@angular-devkit/build-angular" from "H:\\Desktop\\cool-app".
Error: Could not find module "@angular-devkit/build-angular" from "H:\\Desktop\\cool-app".
at Object.resolve (C:\Users\G01205980\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\G01205980\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\src\architect-legacy.js:153:40)
at Observable._trySubscribe (C:\Users\G01205980\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:44:25)
at Observable.subscribe (C:\Users\G01205980\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:30:22)
at C:\Users\G01205980\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:99:19
at new Promise (<anonymous>)
at Observable.toPromise (C:\Users\G01205980\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:97:16)
at ServeCommand.initialize (C:\Users\G01205980\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:130:86)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
PS H:\Desktop\cool-app> npm install
Terminate batch job (Y/N)?
Terminate batch job (Y/N)? n
PS H:\Desktop\cool-app> npm install
[ ...........] \ postinstall: sill install executeActions
答案 0 :(得分:1)
将@angular-devkit/build-angular
安装为dev依赖项。
npm install --save-dev @angular-devkit/build-angular
或
yarn add @angular-devkit/build-angular --dev
答案 1 :(得分:0)
好像没有安装节点依赖项
运行npm install
,然后重试