简体   繁体   English

发生未处理的异常:工作区中未设置配置“生产”

[英]An unhandled exception occurred: Configuration 'production' is not set in the workspace

Hi Created one project in Angular 8. Initially it was supporting only one default language (US-EN).您好在 Angular 8 中创建了一个项目。最初它仅支持一种默认语言(US-EN)。 then I applied localization.然后我应用了本地化。

before localization for preparing production build, I used to give following command.在本地化以准备生产构建之前,我曾经给出以下命令。

ng build --prod --base-href "/Windchill/com/qiwkCollaborator/"

after localization, I made some changes in the angular.json and in package.json.本地化后,我对 angular.json 和 package.Z466DEEC76ECDF324FCA6D385714 进行了一些更改after making these changes whenever I am giving any command to prepare to build it is giving me the following error.每当我发出任何准备构建的命令时进行这些更改后,它都会给我以下错误。

An unhandled exception occurred: Configuration 'production' is not set in the workspace.

some portion of Package.json file is as follows: Package.json 文件的一部分如下:

"name": "qwik-collaborator",
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build-locale:en": "ng build --prod --i18n-locale en --i18n-format xlf --i18n-file src/translate/messages.en.xlf --output-path=dist/en --baseHref /en/",
    "build-locale:fr": "ng build --prod --i18n-locale fr --i18n-format xlf --i18n-file src/translate/messages.fr.xlf --output-path=dist/fr --baseHref /fr/"

some portion of Angular.json file is as follows. Angular.json 文件的某些部分如下。

"build": {

          "configurations": {
            "fr": {
            "aot": true,
            "outputPath": "dist/qwikCollaborator/fr/",
            "i18nFile": "src/translate/messages.fr.xlf",      
            "i18nFormat": "xlf",      
            "i18nLocale": "fr",      
            "i18nMissingTranslation": "error"    
             },
             "en": {
            "aot": true,
            "outputPath": "dist/qwikCollaborator/en/",
            "i18nFile": "src/translate/messages.en.xlf",      
            "i18nFormat": "xlf",      
            "i18nLocale": "en",      
            "i18nMissingTranslation": "error"    
             }  
           },
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/qwikCollaborator",
            "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.scss",
              "src/assets/css/custom-mobile.css",
              "src/assets/css/custom.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js",
              "src/assets/js/qwikCollaborator.js"
            ]
          },
          "configurations": {
          "es5": {
        "tsConfig": "./tsconfig.es5.json"
      },
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
.......


"serve": {
           "configurations": {
            "fr": {
            "browserTarget": "qwikCollaborator:build:fr" 
            },
            "en": {
            "browserTarget": "qwikCollaborator:build:en" 
            } ,
            },
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "qwikCollaborator:build"
          },

          "configurations": {
          "es5": {
        "browserTarget": "qwikCollaborator:build:es5"
      },
            "production": {
              "browserTarget": "qwikCollaborator:build:es5"
            }
          }
        },

can anyone help me with this?谁能帮我这个?

You are building with --prod , which means to use the production configuration, which you obviously removed您正在使用--prod ,这意味着使用production配置,您显然已将其删除

You need to change your build scripts to您需要将构建脚本更改为

"build-locale:en": "ng build -c en --output-path=dist/en --baseHref /en/",
"build-locale:fr": "ng build -c fr --output-path=dist/fr --baseHref /fr/"

Options that are specified in angular.json (like file i18n file format and locations) do not need to be specified again in the build command angular.json中指定的选项(如文件 i18n 文件格式和位置)不需要在构建命令中再次指定

If you want to build using ng build --prod as before, you just need to add the production configuration back into the build target如果您想像以前一样使用ng build --prod ,只需将production配置添加回build目标

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发生未处理的异常:工作区中未设置配置“es” - An unhandled exception occurred: Configuration 'es' is not set in the workspace 发生未处理的异常:工作区中未设置配置“dev” - An unhandled exception occurred: Configuration 'dev' is not set in the workspace Angular ng 服务导致:发生未处理的异常:未在工作区中设置配置“生产” - Angular ng serve leads to: An unhandled exception occurred: Configuration 'production' is not set in the workspace 发生未处理的异常:在工作空间中未设置配置'es5'。 ng在角度8中投放es5 - An unhandled exception occurred: Configuration 'es5' is not set in the workspace. ng serve in angular 8 for es5 工作区中未设置配置“生产” - Angular - Configuration 'production' is not set in the workspace - Angular 发生未处理的异常:D:\workspace-angular\demoapp1 包含 both.browserslistrc 和 browserslist - An unhandled exception occurred: D:\workspace-angular\demoapp1 contains both .browserslistrc and browserslist 发生未处理的异常:NGCC 失败 - An unhandled exception occurred: NGCC failed Angular 配置未设置到工作区 - Angular configuration not set to the workspace Angular - 工作区中未设置配置 - Angular - Configuration is not set in the workspace 运行 ng serve 发生未处理的异常 - Unhandled exception occurred running ng serve
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM