Cannot find module @angular/compiler-cli/src/tooling

Viewed 16653

I am trying to run angular project with npm run start command but getting this error:

Cannot find module @angular/compiler-cli/src/tooling`.

Below is the result of ng --version:

Angular CLI: 7.0.7
Node: 12.14.1
OS: win32 x64
Angular: 7.0.4

package.json

@angular-devkit/architect         0.10.7
@angular-devkit/build-angular     0.1000.4
@angular-devkit/build-optimizer   0.1000.4
@angular-devkit/build-webpack     0.1000.4
@angular-devkit/core              7.0.7
@angular-devkit/schematics        7.0.7
@angular/cdk                      7.3.2
@angular/cli                      7.0.7
@angular/compiler-cli             7.2.16
@angular/material                 7.3.2
@ngtools/webpack                  10.0.4
@schematics/angular               7.0.7
@schematics/update                0.10.7
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.43.0
5 Answers

I think you are missing some package from angular eg @angular/core please compare your package.json file and add accordingly.

enter image description here

One more tip, remove package.lock.json file and then run npm install.

@ngtools/webpack should be of a compatible with other packages version.

"@ngtools/webpack": "7.3.9"

should help

  1. Delete node_modules
  2. update @angular/compiler-cli": "^10.2.0 in package.json
  3. make sure u have the correct node @types/node": "^14.14.2 in package.json
  4. finally npm install

This resolved the error for me

I was able to solve it by clearing the cache using npm cach clean --force and reinstalling the dependencies using npm init

Update angular/cli to the latest version

1- npm uninstall -g angular/cli
2- npm install -g @angular/cli@latest

Update the project dependencies

1- rm -rf node_modules (or delete your node_modules folder manually)
2- npm cache clean (npm > v5 add --force so: npm cache clean --force)
3- npm install --save-dev @angular/cli@latest
4- npm install
Related