Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error Cannot find module '@angular/compiler-cli/ngcc' in angular 8

I am getting this error when I trying to run ng serve from my terminal window.

An unhandled exception occurred: Cannot find module '@angular/compiler-cli/ngcc'

Below is my package.json file

{
  "name": "ProjectDetails",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --extract-css",
    "build": "ng build --extract-css",
    "build:ssr": "npm run build -- --app=ssr --output-hashing=media",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/platform-server": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^3.4.1",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.6",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.1",
    "@angular/cli": "^8.3.1",
    "@angular/compiler-cli": "^5.2.11",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^5.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  },
  "optionalDependencies": {
    "node-sass": "^4.9.0"
  }
}

My angular global version matches the angular/cli version in package .json. They both are 8.3.1. Below is the image for ng --version. I did both the command below, but still getting the same error:

npm uninstall -g @angular/cli
npm install -g @angular/cli

any help will be higly appreciated.

enter image description here

like image 223
Anjali Avatar asked Aug 29 '19 17:08

Anjali


1 Answers

After running these:

npm uninstall -g @angular/cli
npm install -g @angular/cli

Do this:

npm install

If npm audit fix is prompted, run it.

like image 161
Yash Avatar answered Sep 20 '22 21:09

Yash