从angular 5更新到angular 6时找不到本地工作区文件('angular.json')

时间:2018-07-30 10:16:47

标签: angular6

我正在按照更新将Angular 5项目更新为Angular 6,

npm install --save-dev @angular/cli@latest
ng update @angular/cli
ng update @angular/core
ng update @angular/material
ng update rxjs

但是当运行ng服务时,错误不断出现,如下所示

  

找不到本地工作区文件('angular.json')

有人告诉我.angular-cli.json被一个新的替换:angular.json,但是架构不再是旧版本

这是我当前的angular-cli.json,如何更改为angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "ngx-admin-demo"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico",
        "favicon.png",
        {
          "glob": "**/*",
          "input": "../node_modules/leaflet/dist/images",
          "output": "./assets/img/markers"
        }
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.css",

        "./app/@theme/styles/styles.scss",
        "../node_modules/primeng/resources/themes/omega/theme.css",
        "../node_modules/primeng/resources/primeng.min.css",
        "styles.scss"
      ],
      "scripts": [


        "../node_modules/pace-js/pace.min.js",
        "../node_modules/echarts/dist/echarts.min.js",
        "../node_modules/chart.js/dist/Chart.min.js",
        "../src/assets/paho-mqtt.js"
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {}
  }
}

1 个答案:

答案 0 :(得分:6)

您可能需要保存更改,请尝试运行以下命令:

$ ng update @angular/cli --save