gpt4 book ai didi

angular - ng build --prod 问题

转载 作者:太空狗 更新时间:2023-10-29 18:13:49 25 4
gpt4 key购买 nike

我正在使用最新版本的@angular/cli,但我的 Angular2 应用程序出现了一个奇怪的错误。

在执行 ng build --pro 之后,包不能正常工作,我可以在控制台中看到这个错误:

异常:无法设置只有 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"
}

最佳答案

我找到了问题...借助这张票: 4720

通过在 ng build 命令中添加 --aot=false 来关闭 aot 可以解决问题。

此外,我已将 typescript 版本提高到 2.1.6。

关于angular - ng build --prod 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42256243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com