2

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

$ npm run start

> [email protected] 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:


> [email protected] 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!

2

4 Answers 4

3

Try to run this

npm install --save-dev @angular-devkit/build-angular
Sign up to request clarification or add additional context in comments.

3 Comments

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:[email protected]": 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
did you tried installing --forcefully? npm i -f
This worked for me. I installed 8 packages to support my application. 7 of them went nicely into the global area (-g), but for some reason, @angular-devkit/build-angular needs to install directly into the project root folder. (At least in my instance, for some - unknown - reason.)
1

Try this command in your terminal:

npm i -D @angular-devkit/build-angular

2 Comments

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:[email protected]": 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
The package name is @angular-devkit/build-angular - without the :dev-server
1

You may try these commands

npm install --legacy-peer-deps:

or

npm install --force

latter one solved issue in my case.

you can read more npm: When to use `--force` and `--legacy-peer-deps`

Comments

1

Unsure of your platform (I'm on Debian 12/Chromebook's Linux beta), but I had success doing:

npm install --force @angular-cli

Afterward it worked perfectly.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.