ng build --prod问题

时间:2017-02-15 17:26:48

标签: angular build angular-cli

我正在使用@ angular / cli的最新版本,并且在Angular2 App中出现了一个奇怪的错误。

在进行构建之后--pro捆绑包无法正常工作,我可以在控制台中看到此错误:

EXCEPTION:无法设置只有getter的#的属性值

但是,制作一个无参数构建,运行正常,任何想法?

这是我的package.json

的一大块

  "dependencies": {
    "@angular/common": "^2.4.6",
    "@angular/compiler": "^2.4.6",
    "@angular/core": "^2.4.6",
    "@angular/forms": "^2.4.6",
    "@angular/http": "^2.4.6",
    "@angular/platform-browser": "^2.4.6",
    "@angular/platform-browser-dynamic": "^2.4.6",
    "@angular/router": "^3.4.0",
    "body-parser": "^1.16.0",
    "btoa": "^1.1.2",
    "compression": "^1.6.2",
    "config": "^1.24.0",
    "core-js": "^2.4.1",
    "cors": "^2.8.1",
    "express": "^4.14.0",
    "express-minify": "^0.2.0",
    "express-uglify": "^0.3.1",
    "http-proxy-middleware": "^0.17.3",
    "jsonschema": "^1.1.1",
    "jsonwebtoken": "^7.2.1",
    "ng2-bootstrap": "^1.2.6",
    "nodemailer": "^2.7.2",
    "request": "^2.79.0",
    "request-ip": "^1.2.3",
    "request-promise": "^4.1.1",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "winston": "^2.3.1",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-beta.31",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.1",
    "frisby": "^0.8.5",
    "jasmine-core": "2.5.2",
    "jasmine-node": "^1.14.5",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "^1.0.2",
    "nodemon": "^1.11.0",
    "protractor": "~5.1.0",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.0"
  }

1 个答案:

答案 0 :(得分:6)

我在这张票的帮助下找到了问题: 4720

通过在ng build命令期间添加--aot = false来关闭aot,它解决了问题。

我也将打字稿版本提升到2.1.6。