1

在通过成功安装 PWA 组件以使我的 Angular 应用程序成为渐进式 Web 应用程序ng add @angular/pwa --project myProjectName后,我似乎无法再启动我的应用程序了。

当我尝试通过我启动我的应用程序时,ng serve -o我收到此错误消息:

发生未处理的异常:找不到模块'@angular/compiler-cli/ngcc'
有关详细信息,请参阅“/tmp/ng-JO4KFv/angular-errors.log”。

我尝试卸载 Angular CLI 并根据此处的说明重新安装它的最新版本,但这根本没有帮助。

如何解决此问题并使其正常工作?

在我的 Angular 应用环境下面找到: 我的角度环境

{
  "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"
  }
}
4

2 回答 2

0

尝试这个,

尝试删除它"angular/cli": "1.0.0-beta.28.3",在devDependencies中它是无用的,并添加它而不是它"@angular/compiler-cli": "^2.3.1",(因为它是当前版本,否则添加它npm i --save-dev @angular/compiler-cli),然后在你的根应用程序文件夹中运行这些命令:

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
于 2019-09-24T06:47:28.513 回答
0

看起来你有一个更新的GLOBALangular cli (vs 8.3.5) 但依赖项in your project are very OLD.

尝试在您的项目中运行 ng update --force 或遵循本指南

https://update.angular.io/

希望对你有帮助!!

于 2019-09-24T06:57:23.450 回答