简体   繁体   English

发生未处理的异常:文件替换中的 \environments\environment.prod.ts 路径不存在

[英]An unhandled exception occurred: \environments\environment.prod.ts path in file replacements does not exist

I moved environment.prod.ts file to this directory 'C:\DailyProcess\daily-process\src\WebUI\Angular\src\environments\environment.prod.ts' and get this error.我将 environment.prod.ts 文件移动到此目录 'C:\DailyProcess\daily-process\src\WebUI\Angular\src\environments\environment.prod.ts' 并收到此错误。 I need assistance and am seeking a possible solution to this error.我需要帮助,正在寻求解决此错误的可能方法。 This is what I have in my package.json file.这就是我的 package.json 文件中的内容。

package.json package.json

{
 "name": "daily-process",
  "version": "0.0.0",
  "scripts": {
   "ng": "ng",
   "start": "ng serve",
   "build": "ng build",
   "watch": "ng build --watch --configuration development",
   "test": "ng test"
    },
  "private": true,
  "dependencies": {
  "@angular/animations": "~13.2.0",
  "@angular/common": "~13.2.0",
  "@angular/compiler": "~13.2.0",
  "@angular/core": "~13.2.0",
   "@angular/forms": "~13.2.0",
  "@angular/platform-browser": "~13.2.0",
  "@angular/platform-browser-dynamic": "~13.2.0",
  "@angular/router": "~13.2.0",
 "rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.2.1",
"@angular/cli": "~13.2.1",
"@angular/compiler-cli": "~13.2.0",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
  "jasmine-core": "~4.0.0",
  "karma": "~6.3.0",
  "karma-chrome-launcher": "~3.1.0",
  "karma-coverage": "~2.1.0",
   "karma-jasmine": "~4.0.0",
  "karma-jasmine-html-reporter": "~1.7.0",
  "typescript": "~4.5.2"
  }
}

environment.prod.ts环境.prod.ts

 export const environment = {
 production: true

}; };

angular.json angular.json

 {
   "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
   "version": 1,
   "newProjectRoot": "projects",
   "projects": {
   "daily-process": {
  "projectType": "application",
  "schematics": {},
  "root": "",
  "sourceRoot": "src",
  "prefix": "app",
  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/daily-process",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.app.json",
        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [
          "src/styles.css"
        ],
        "scripts": []
      },
      "configurations": {
        "production": {
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "2mb",
              "maximumError": "5mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumWarning": "6kb",
              "maximumError": "10kb"
            }
          ],
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "outputHashing": "all"
        },
        "development": {
          "buildOptimizer": false,
          "optimization": false,
          "vendorChunk": true,
          "extractLicenses": false,
          "sourceMap": true,
          "namedChunks": true
        }
      },
      "defaultConfiguration": "production"
    },
    "serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "configurations": {
        "production": {
          "browserTarget": "daily-process:build:production"
        },
        "development": {
          "browserTarget": "daily-process:build:development"
        }
      },
      "defaultConfiguration": "development"
    },
    "extract-i18n": {
      "builder": "@angular-devkit/build-angular:extract-i18n",
      "options": {
        "browserTarget": "daily-process: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": []
        }
      }
    }
  }
},
"defaultProject": "daily-process"
 }

Figured it out.弄清楚了。 I had the environment files in the wrong directory.我在错误的目录中放置了环境文件。 Once I moved them to the correct area my build worked.一旦我将它们移动到正确的区域,我的构建就起作用了。

I had those files in the 'C:\DailyProcess\daily-process\src\WebUI\Angular\environments\ and it needed to be in 'C:\DailyProcess\daily-process\src\WebUI\Angular\src\environments\我在 'C:\DailyProcess\daily-process\src\WebUI\Angular\environments\ 中有这些文件,它需要在 'C:\DailyProcess\daily-process\src\WebUI\Angular\src\environments\

暂无
暂无

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

相关问题 在 Docker 中构建 Angular 会抛出“文件替换中的 environment.prod.ts 路径不存在” - Building Angular in Docker throws "environment.prod.ts path in file replacements does not exist" 在environment.prod.ts文件上进行条件 - make condition on environment.prod.ts file 发生未处理的异常:脚本文件../node_modules/chart.js 不存在 - An unhandled exception occurred: Script file ../node_modules/chart.js does not exist 发生未处理的异常:作业名称“..getProjectMetadata”不存在 - An unhandled exception occurred: Job name "..getProjectMetadata" does not exist Angular 14 发生未处理的异常:脚本文件 node_modules/tinymce/themes/modern/theme.min.js 不存在 - Angular 14 An unhandled exception occurred: Script file node_modules/tinymce/themes/modern/theme.min.js does not exist 运行 ng serve 发生未处理的异常 - Unhandled exception occurred running ng serve 发生未处理的异常:找不到模块“./browsers”- - An unhandled exception occurred: Cannot find module './browsers' - 对于非本地、非生产环境的 NodeJS 项目,nwrl nx 环境文件不会被替换 - nwrl nx environment files is not replaced for NodeJS project for non-local, non-prod environments 发生未处理的异常:无法读取未定义的属性“减号” - An unhandled exception occurred: Cannot read property 'Minus' of undefined 发生未处理的异常:找不到模块 './features/colr-v1' - An unhandled exception occurred: Cannot find module './features/colr-v1'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM