[Resolved] An unhandled exception occurred: cannot find module '@angular-devkit/build-angular/package.json'

Dung Do Tien Sep 08 2020 68

Hello,

I have a cms template with angular 9. I downloaded it from the CoreUI website and after installed Node.js and Angular CLI I ran the command below :

ng serve --port 4201 -o

But I got an error as below:

An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- 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-K14NxG\angular-errors.log" for further details.

I ran ng update  command but it not work for me.

Have 3 answer(s) found.
  • You can try one in two option below, I hope it works for you.

    1. Option 1

    Install @angular-devkit/build-angular as a dev dependency. This package is newly introduced in Angular 6.0

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

    OR

    yarn add @angular-devkit/build-angular --dev 

    2. Option 2

    You need to update npm.

    npm update 

     

    Sandeep Kumar Sep 08 2020
  • I fixed by way:

    1. Delete node_modules folder.

    2. run  npm install command.

    I hope it helpful for you.

    Marry Christ Sep 25 2020
  • Hi, Sandeep Kumar

    Thanks many for your solution, I fixed my issues with your option 1. 

    Dung Do Tien Sep 25 2020
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