[Resolved] An unhandled exception occurred: Cannot find module '@angular/compiler-cli'

Dung Do Tien Sep 09 2020 4821

I have a web application created by angular 9.  After running the command below I get an error :

ng serve -o

And I got an error as below:

An unhandled exception occurred: Cannot find module '@angular/compiler-cli'
Require stack:
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@ngtools\webpack\src\index.js
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\typescript.js
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\webpack-configs\index.js
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@angular-devkit\build-angular\src\browser\index.js
- C:\Project\source_refer\coreui-free-angular-admin-template-master\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\commands\serve-impl.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\conta\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\conta\AppData\Local\Temp\ng-EyFbT1\angular-errors.log" for further details.

Thanks for any suggestions.

Have 1 answer(s) found.
  • S

    Sandeep Kumar Sep 09 2020

    1. You need update angular-cli to the latest version

    $ npm remove -g angular-cli
    $ npm install -g @angular/cli@latest 

    2. Update the project dependencies

    $ npm rm -rf node_modules dist
    $ npm install --save-dev @angular/cli@latest
    $ npm install 
    
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close