学习Angular, 尝试做those simple steps来生成新项目,但是当我尝试启动ng-serv时遇到了以下错误:
Could not find module "@angular-devkit/build-angular" from "C:\\Users\\lingar\\AngularProjects2\\project1".
Error: Could not find module "@angular-devkit/build-angular" from "C:\\Users\\lingar\\AngularProjects2\\project1".
at Object.resolve (C:\Users\lingar\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\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\src\architect.js:132:40)
at Observable._trySubscribe (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:43:25)
at Observable.subscribe (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:29:22)
at DoOperator.call (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\tap.js:29:23)
at Observable.subscribe (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:24:22)
at C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeTo.js:22:31
at Object.subscribeToResult (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\util\subscribeToResult.js:7:45)
at MergeMapSubscriber._innerSub (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:75:38)
at MergeMapSubscriber._tryNext (C:\Users\lingar\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:72:14)
尝试了许多those solutions,但均未成功。
有人有想法吗?
编辑:已解决!
感谢@Seth McClaine在我对the Technical Specifications of this module @angular-devkit/build-angular所做的评论中的回答
从那里开始安装命令并在cmd上运行它:
npm i @angular-devkit/build-angular
,
从那时起,它运行良好。
BTW-解决方案之前我遇到了一个奇怪的问题,那就是只有在根用户目录中,它才能很好地工作。
答案 0 :(得分:3)
尝试一下。
npm i --only=dev
在npm安装并运行项目后