Angular ng build不识别除dev和prod之外的任何环境

Angular ng build不识别除dev和prod之外的任何环境,angular,Angular,当我尝试运行以下命令时,有人能告诉我为什么会出现以下错误吗?也许我做得不对?我有预测试和测试,我想建立不同于开发或产品 任何帮助都将不胜感激 ng build --enivronment=pretest --target=pretest -bh http://somehost.stuff.gov:7019 我得到以下错误: The option '--enivronment' is not registered with the build command. Run `ng build

当我尝试运行以下命令时,有人能告诉我为什么会出现以下错误吗?也许我做得不对?我有预测试和测试,我想建立不同于开发或产品

任何帮助都将不胜感激

ng build --enivronment=pretest --target=pretest -bh http://somehost.stuff.gov:7019
我得到以下错误:

    The option '--enivronment' is not registered with the build command. Run `ng build --help` for a list of supported options.
Invalid build target. Only 'development' and 'production' are available.
Error: Invalid build target. Only 'development' and 'production' are available.
    at NgCliWebpackConfig.validateBuildOptions (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\models\webpack-config
.js:55:19)
    at new NgCliWebpackConfig (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\models\webpack-config.js:12:14)
    at Class.run (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\tasks\build.js:30:31)
    at Class.run (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\commands\build.js:216:26)
    at resolve (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
    at new Promise (<anonymous>)
    at Class.validateAndRun (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\ember-cli\lib\models\command.js:240:12)
    at Promise.resolve.then.then (C:\Users\Denis.Putnam\Documents\development\pcocar-app\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:140:24)
    at <anonymous>

是环境方面的打字错误吗? ng构建-环境=预测试-目标=预测试-bhhttp://somehost.stuff.gov:7019


Angular并不总是支持多个构建环境,因此我还将检查您正在运行的版本。

请看这一点,您是正确的。我看到打字错误了。你能告诉我-target是做什么用的吗?它只是另一种构建的方式。ng build可以指定生成目标-target=production或-target=development以及要与该生成-environment=dev或-environment=prod一起使用的环境文件。默认情况下,使用开发生成目标和环境。
    {
  "project": {
    "version": "1.0.0-beta.28.3",
    "name": "pcocar-app"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "pretest": "environments/environment.pretest.ts",
        "test": "environments/environment.test.ts",
        "preprod": "environments/environment.preprod.ts",        
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "files": "src/**/*.ts",
      "project": "src/tsconfig.json"
    },
    {
      "files": "e2e/**/*.ts",
      "project": "e2e/tsconfig.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "prefixInterfaces": false,
    "inline": {
      "style": false,
      "template": false
    },
    "spec": {
      "class": false,
      "component": true,
      "directive": true,
      "module": false,
      "pipe": true,
      "service": true
    }
  }
}