角度 cli 应用程序中不存在环境“uat”

cod*_*uru 5 angular-cli angular

我正在尝试使用以下命令 ng build --env=uat --prod -bh / 构建 Angular cli (版本 5 )应用程序

我收到错误“环境“uat”不存在”。

我在 angular-cli.json 中有以下几行

`   "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts",
        "uat": "environments/environment.uat.ts"
      }`
Run Code Online (Sandbox Code Playgroud)

我创建了文件environments/environment.uat.ts。

您能让我知道问题可能是什么吗?

小智 2

这让我很惊讶,也许值得一试......

"uat": "environments/environment.uat.ts" 必须位于 .angular-cli.json 中(注意文件名开头的点)

我在另一个 angular-cli.json 文件中有该行。因此,请检查您是否更新了正确的 json 文件,您的项目中可能有 2 个文件。