1

After successfully installing the PWA component in order to make my Angular app a Progressive Web Application via ng add @angular/pwa --project myProjectName, I cant seem to fire up my app any more.

When I try starting up my app via ng serve -o I get this error message:

An unhandled exception occurred: Cannot find module '@angular/compiler-cli/ngcc'
See "/tmp/ng-JO4KFv/angular-errors.log" for further details.

I tried to uninstall the Angular CLI and re-install the latest version of it according to the instructions here but this hasn't helped at all.

How do I resolve this issue and get this to work?

Find below my Angular app environment: my Angular Environment

{
  "name": "myProjectName",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.2",
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.2.1",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/material": "^6.2.1",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/platform-server": "^6.1.0",
    "@angular/router": "^6.1.0",
    "@jaspero/ng-alerts": "^0.1.1",
    "@jaspero/ng2-confirmations": "^0.3.3",
    "@jaspero/ng2-select": "^0.1.2",
    "@material/top-app-bar": "^3.2.0",
    "@ng-bootstrap/ng-bootstrap": "^2.0.0",
    "@ngx-loading-bar/core": "^1.2.0",
    "angular-calendar": "^0.26.4",
    "angular2-image-zoom": "^1.2.1",
    "angular2-notifications": "^0.9.7",
    "axios": "^0.18.0",
    "bootstrap": "^4.0.0",
    "core-js": "^2.5.4",
    "date-fns": "^1.29.0",
    "echarts": "^4.1.0",
    "jquery": "^3.3.1",
    "moment": "^2.22.0",
    "ng-sidebar": "^7.0.1",
    "ng-spin-kit": "^5.1.1",
    "ng2-archwizard": "^2.1.0",
    "ng2-search-filter": "^0.4.7",
    "ng2-spin-kit-new": "^1.0.3",
    "ng6-toastr-notifications": "^1.0.4",
    "ngx-avatar": "^2.9.0",
    "ngx-bootstrap": "^2.0.5",
    "ngx-cookie-service": "^1.0.10",
    "ngx-drag-scroll": "^1.7.3",
    "ngx-echarts": "^4.0.0",
    "ngx-pagination": "^4.1.0",
    "rxjs": "^6.2.0",
    "rxjs-compat": "^6.2.0",
    "socket.io-client": "^2.0.3",
    "sockjs-client": "^1.1.5",
    "stompjs": "^2.3.3",
    "sweetalert2": "^7.12.15",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.7.5",
    "@angular/cli": "^6.2.1",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "6.0.4",
    "@types/echarts": "0.0.13",
    "@types/googlemaps": "^3.30.8",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^3.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.4.0",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "2.9.2"
  }
}
Sagar V
  • 12,158
  • 7
  • 41
  • 68
SirBT
  • 1,580
  • 5
  • 22
  • 51

2 Answers2

0

Try this,

Try to delete that "angular/cli": "1.0.0-beta.28.3", in the devDependencies it is useless , and add instead of it "@angular/compiler-cli": "^2.3.1", (since it is the current version, else add it by npm i --save-dev @angular/compiler-cli ), then in your root app folder run those commands:

1. rm -r node_modules (or delete your node_modules folder manually)
2. npm cache clean --force (doesnt not work in npm v5)
3. npm install
Sagar V
  • 12,158
  • 7
  • 41
  • 68
Dixit Savaliya
  • 413
  • 3
  • 7
  • Thanks for your prompt response, however, there isn't an `"angular/cli": "1.0.0-beta.28.3"` in the list of dependencies to delete. Did you perhaps mean `"@angular/cli": "^6.2.1",`? – SirBT Sep 24 '19 at 08:09
0

it looks like you have a updated GLOBAL angular cli (vs 8.3.5) but the dependencies in your project are very OLD.

Try to run an ng update --force inside your project or follow this guide

https://update.angular.io/

Hope it helps you!!

federico scamuzzi
  • 3,708
  • 1
  • 17
  • 24