Angular 6 找不到 .angular-cli.json 并更改 outDir

Angular 6 can't find .angular-cli.json and change the outDir

我遵循了一个在线教程,该教程说我必须在 .angular-cli.json 文件中设置 outDir。当我 运行 ng 构建时,这会将编译后的代码放在我的 app.js 文件夹中指定的正确目录中。问题是我无法在任何地方找到该文件。教程link

解决方案已完成并且没有错误,我现在要做的就是将 Angular 连接到我的后端,并将其 运行 连接到 localhost:3000。到目前为止,我只在 tsconfig.json 文件中发现了 outdir。当我 运行 编译器时,文件最终位于默认的 dist 文件夹中。

您所指的教程使用的是 Angular 2,最新版本 Angular 是 6

从 angular 6 开始的 CLI 项目将使用 angular.json 而不是 .angular-cli.json 进行构建和项目配置。

每个 CLI 工作区都有项目,每个项目都有目标,每个目标都可以有配置。Docs
如果要将生成的工件存放在自定义位置修改输出路径从"outputPath": "dist/ng6","outputPath": "dist/yourcustomlocation",build target

    {
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ng6": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/ng6",**<----/modify this**
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets":

此外,本教程使用 HttpModule,您应该使用 HttpClientModule,而不是