Fabian Rico
Fabian Rico

Reputation: 97

Problem trying to run ng serve in Angular Project 'Cannot find module "@angular-devkit/build-angular/package.json' "

I´m trying to run an Angular project through ng serve, but desafortunately doesn´t run. The next message show in the console:

An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- C:\Project\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
- C:\Project\node_modules\@angular-devkit\architect\node\index.js
- C:\Project\node_modules\@angular\cli\models\architect-command.js
- C:\Project\node_modules\@angular\cli\commands\serve-impl.js
- C:\Project\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Project\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Project\node_modules\@angular\cli\utilities\json-schema.js
- C:\Project\node_modules\@angular\cli\models\command-runner.js
- C:\Project\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\Test\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\Test\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\Test\AppData\npm\ng-Tomy1t\angular-errors.log" for further details.

How Can I fix this issue?

Upvotes: 1

Views: 2163

Answers (1)

SELA
SELA

Reputation: 6793

This package was newly introduce from angular 6.0 onwards, You need to Install @angular-devkit/build-angular as dev dependency.

Try adding the devkit using this command:

If you are using NPM Package manager:

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

If you are using yarn package manager:

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

Upvotes: 1

Related Questions