0

I am having problems creating angular projects. Until a few moments ago it was working fine, but now when I create a new project( ng new <project_name> ) the node_modules folder that contains all installed dependencies doesn't appear anymore.

I can't even run( ng serve ) the project because of this. It just prints on the screen:

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.

I tried all these commands:

npm uninstall --save-dev @angular/cli
npm uninstall --save @angular/cli
npm cache clean --force
npm install --save @angular/cli
npm install

Especially npm install that only prints up to date in 662ms. Also in other projects that have the folder, when I try to install other dependencies it only shows as in the example:

changed 36 packages in 14s
2 packages are looking for funding

I search the project and find nothing. I don't know what else to do. If someone can please help me solve this I would really appreciate it.


EDIT ---------- SOLUTION

I finally managed to solve it with the option of an older version of npm, which in my case was npm install -g npm@7, and then I was able to use the npm install command. The node_modules folder with all the dependencies is working fine now. The only thing you have to watch out for later is the dependency conflicts.

4
  • 1
    Try deleting node_modules folder and then just run npm install in the project root (without mentioning any dependency name) Commented Jun 23, 2023 at 14:44
  • I tried that too, but it didn't work Commented Jun 23, 2023 at 14:48
  • @lys_18 Did you run commands in correct directory? Commented Jun 23, 2023 at 14:59
  • yes, directly in my project folder Commented Jun 23, 2023 at 16:18

1 Answer 1

0

The error is saying it cannot find "@angular-devkit/build-angular:dev-server". so you should install it using the following command. The command will fail if you do not have peerDependencies set to true so I will add the force flag.

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

2 Comments

thanks for the answer, but it didn't work
Ok refer to the following links, you may find an answer there stackoverflow.com/questions/50333003/… stackoverflow.com/questions/56623458/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.