当我尝试运行“ng serve”命令时,我收到以下错误:
[错误]错误:“buildOptimizer”选项不能在没有“aot”的情况下使用。
at generateWebpackConfig (C:\Users\Acasa\0 SDA\0 Proiecte practice\0 onlineMall\onlineMallApp\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:45:15)
at generateBrowserWebpackConfigFromContext (C:\Users\Acasa\0 SDA\0 Proiecte practice\0 onlineMall\onlineMallApp\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:125:26)
at async generateI18nBrowserWebpackConfigFromContext (C:\Users\Acasa\0 SDA\0 Proiecte practice\0 onlineMall\onlineMallApp\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:73:20)
at async setup (C:\Users\Acasa\0 SDA\0 Proiecte practice\0 onlineMall\onlineMallApp\node_modules\@angular-devkit\build-angular\src\builders\dev-server\index.js:134:47)
我已经尝试了在互联网上找到的所有解决方案,但没有一个为我工作。许多人建议做一些修改到angular.json文件,但没有为我工作。
这是我的angular.json文件内容。
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-ecommerce": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular-ecommerce",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/@fortawesome/fontawesome-free/css/all.min.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot":true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-ecommerce:build"
},
"configurations": {
"production": {
"browserTarget": "angular- ecommerce:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-ecommerce:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular-ecommerce:serve"
},
"configurations": {
"production": {
"devServerTarget": "angular-ecommerce:serve:production"
}
}
}
}
}},
"defaultProject": "angular-ecommerce",
"cli": {
"analytics": false
}
}
1条答案
按热度按时间j8ag8udp1#
内部版本选项集
“aot”:真,