angular cli找不到模块

时间:2019-01-11 19:22:30

标签: angular

Could not find module "@angular-devkit/build-angular" from "C:\\College-Portal-master".
Error: Could not find module "@angular-devkit/build-angular" from "C:\\College-Portal-master".
    at Object.resolve (C:\Users\Admin\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\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\src\architect.js:132:40)
    at Observable._trySubscribe (C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe (C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:30:22)
    at C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:99:19
    at new Promise (<anonymous>)
    at Observable.toPromise (C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Observable.js:97:16)
    at ServeCommand.initialize (C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:130:86)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)

2 个答案:

答案 0 :(得分:0)

从错误消息中可以很明显地看出,@angular-devkit/build-angular在已安装的node_modules中不可用。

只需运行:

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

你应该很好。

答案 1 :(得分:0)

您可能正确执行了安装步骤,但未正确安装。

ng update检查是否有最新的棱角商品。

npm outdated一起检查,看是否有一些包裹让您烦恼。

如果您具有代理,并且不允许安装CLI的某些部分,请使用

将代理添加到节点
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

如果问题出在git上,请安装git。

如果问题出在依赖项上,请确保使用npm i @lacking-dependency

更新它们

此外,请务必知道区别between --save-dev and --save