Error: Local workspace file ('angular.json') could not be found when upgraded to Angular 6

Error: Local workspace file ('angular.json') could not be found when upgraded to Angular 6

我已将我的项目从 Angular 5 升级到 Angular 6。当我尝试 运行 使用 npm start 的应用程序时,它抛出以下错误。

我知道已经有类似这样的问题有答案了,但我尝试了其中的大部分,但这些问题都不适合我。

我正在从 Angular 版本 5 迁移到版本 6。我注意到 angular 5 正在使用 .angular-cli.json 文件,而在将其迁移到版本 6 后,我发现 Angular 6 版本不支持 .angular-cli.json 文件。因此,为了使我的项目正常运行,我已将 .angular-cli.json 文件迁移到 angular.json。我使用了下面的命令。

ng update @angular/cli --from=1.7.4 --to=6 --migrate-only

然后我按照以下步骤操作。

  1. 我已经从我的应用程序中删除了我的 node_modules 包。
  2. 已使用 npm cache clean
  3. 清理缓存
  4. 使用 npm cache verify
  5. 验证缓存
  6. 使用 npm install
  7. 重新安装

完成上述步骤后,它对我有用。