1

On a MEAN course project I cannot run it because I am getting the below error:

$ npm run start

> mean-course@0.0.0 start
> ng serve

Node packages may not be installed. Try installing with 'npm install'.
Error: Could not find the '@angular-devkit/build-angular:dev-server' builder's node package.

So I go into the package.json file and under "devDependencies" add the line:

"@angular-devkit/build-angular:dev-server": "15.1.6", 

Then I try to run npm run start and I get the error below stating that the dependency is still not installed:


> mean-course@0.0.0 start
> ng serve

Node packages may not be installed. Try installing with 'npm install'.
Error: Could not find the '@angular-devkit/build-angular:dev-server' builder's node package.

Anybody have the same problem or know a solution? Any help would be appreciated thank you!

Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
Njhasty
  • 39
  • 4
  • have you run npm install before npm start ? – jeremy-denis Feb 16 '23 at 10:25
  • Does this answer your question? [Angular 6 - Could not find module "@angular-devkit/build-angular"](https://stackoverflow.com/questions/50333003/angular-6-could-not-find-module-angular-devkit-build-angular) – jeremy-denis Feb 16 '23 at 10:32

2 Answers2

1

Try this command in your terminal:

npm i -D @angular-devkit/build-angular
Miguel
  • 188
  • 5
  • Did this and got the following error: $ npm i -D @angular-devkit/build-angular npm ERR! code EINVALIDPACKAGENAME npm ERR! Invalid package name "@angular-devkit/build-angular:dev-server" of package "@angular-devkit/build-angular:dev-server@15.1.6": name can only contain URL-friendly characters. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\615608\AppData\Local\npm-cache\_logs\2023-02-16T14_17_48_576Z-debug-0.log – Njhasty Feb 16 '23 at 14:18
  • The package name is `@angular-devkit/build-angular` - without the `:dev-server` – Pieterjan Feb 19 '23 at 20:02
1

Try to run this

npm install --save-dev @angular-devkit/build-angular
  • I did this and got the following error: $ npm i -save-dev @angular-devkit/build-angular npm ERR! code EINVALIDPACKAGENAME npm ERR! Invalid package name "@angular-devkit/build-angular:dev-server" of package "@angular-devkit/build-angular:dev-server@15.1.6": name can only contain URL-friendly characters. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\615608\AppData\Local\npm-cache\_logs\2023-02-16T14_16_12_813Z-debug-0.log – Njhasty Feb 16 '23 at 14:17
  • did you tried installing --forcefully? npm i -f – Ganesh Dammuluri Feb 19 '23 at 09:38