Angular-cli:运行生产构建时的问题

时间:2018-02-19 07:34:50

标签: javascript angular angular-cli

请帮我解决这个问题。当我从我的cli运行生产版本时,我遇到了这个问题。我的cli版本是1.6.3,我的项目依赖CLI版本是1.2.1。我如何解决这个问题或者需要升级整个项目(那不是我想要的)。

    $ ng build --prod
Your global Angular CLI version (1.6.3) is greater than your local version (1.2.1). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Hash: f201dcfb179e407e5fb3
Time: 37909ms
chunk    {0} polyfills.38aeb50ad1f41473eae7.bundle.js (polyfills) 194 kB {5} [initial] [rendered]
chunk    {1} styles.ffe72c46cba02439e1ba.bundle.css (styles) 228 bytes {5} [initial] [rendered]
chunk    {2} scripts.52e1564e2a73a28801f0.bundle.js (scripts) 443 kB {5} [initial] [rendered]
chunk    {3} main.bfbde393948c0a677c68.bundle.js (main) 1.1 kB {4} [initial] [rendered]
chunk    {4} vendor.f064b8d9b09085c93ce8.bundle.js (vendor) 863 kB [initial] [rendered]
chunk    {5} inline.95d1e21a4da9a9b357b4.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'E:\localhost\htdocs\projects\virtual-tour\git\virtualteam\Angular\src'
 @ ./src/main.ts 3:0-74
 @ multi ./src/main.ts

ERROR in ./src/$$_gendir async
Module not found: Error: Can't resolve 'E:\localhost\htdocs\projects\virtual-tour\git\virtualteam\Angular\src\$$_gendir\app\tours\tours.module.ngfactory.ts' in 'E:\localhost\htdocs\projects\virtual-tour\git\virtualteam\Angular\src\$$_gendir'
 @ ./src/$$_gendir async
 @ ./~/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi ./src/main.ts

因为我也害怕package.json文件。请检查此文件,让我知道一个正确的解决方案,使生产构建没有错误。以下是package.json文件

{
  "name": "vtd",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@ngx-translate/core": "^8.0.0",
    "@ngx-translate/http-loader": "^2.0.0",
    "angular-io-slimscroll": "^1.2.11",
    "angular2-social-auth": "^3.0.3",
    "angular2-social-login": "^3.1.1",
    "chart.js": "^2.7.0",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "ng2-owl-carousel": "^0.1.15",
    "ngx-carousel": "^1.1.0",
    "ngx-pagination": "^3.0.3",
    "primeng": "^4.1.3",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.2.1",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "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": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}

0 个答案:

没有答案