Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'npm ERR! missing script: ngcc' error with NPM

Tags:

npm

angular

From one day to another my project in Visual Studio Code started to show this two errors: enter image description here

In fact, almost all tags from angular material are marked as error not recognizing as tags.

I tried using npm run ngcc but this error appeared:

npm ERR! missing script: ngcc

Also, i tried to reinstall npm but is the same.

like image 684
Camila Margni Avatar asked Nov 05 '25 18:11

Camila Margni


1 Answers

I don't think you should set ivy compiler to false because that's the new compiler that is standard in the latest Angular versions, so I think that should be the last option if you can't get it to work.

Ivy compiler

Ivy is the code name for Angular's next-generation compilation and rendering pipeline. With the version 9 release of Angular, the new compiler and runtime instructions are used by default instead of the older compiler and runtime, known as View Engine.

AOT compilation with Ivy is faster and should be used by default. In the angular.json

Try delete node_modules and installing dependencies from package.json will hopefully fix the problem.

rm -rf node_modules/
npm install 

This command will remove node_modules and then install the dependencies from your package.json file.

OR:

It could also work to updated angular cli, material(If you use it) and core, and other modules needed for your project, then updated npm and typescript package, which could also solve the problem.

ng update @angular/cli @angular/core
npm update @angular/material @angular/cdk
npm install -g typescript@latest

Then check that your build-angular is set to the same version that you use for Angular:

@angular-devkit/build-angular": "Your current version of angular"
like image 101
Filip Huhta Avatar answered Nov 07 '25 08:11

Filip Huhta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!