错误:找不到本地工作区文件('angular.json') [英] Error: Local workspace file ('angular.json') could not be found

查看:407
本文介绍了错误:找不到本地工作区文件('angular.json')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将travis-ci与我的GitHub帐户集成( https://github.com/pradeep0601/Angular5-Router-App ).

I have travis-ci integrated with my GitHub account (https://github.com/pradeep0601/Angular5-Router-App).

当我将@angular/cli版本从1.7.4更新到6.0.0-rc.3时,构建开始失败并出现错误:

When I updated @angular/cli version from 1.7.4 to 6.0.0-rc.3, the build started failing with an error:

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:37:19)
    at WorkspaceLoader.loadWorkspace (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:24:21)
    at TestCommand._loadWorkspaceAndArchitect (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:177:32)
    at TestCommand.<anonymous> (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:45:25)
    at Generator.next (<anonymous>)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:3:12)
    at TestCommand.initialize (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:44:16)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/command-runner.js:100:23

package.json代码片段可更好地了解运行环境:

package.json snippet to better understand the running environment:

    "@angular/cli": "6.0.0-rc.3",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",

推荐答案

我只是遇到了同样的问题.

I just had the same problem.

它与版本v6.0.0-rc.2有关, https://github.com/angular/angular-cli/releases :

It's related to release v6.0.0-rc.2, https://github.com/angular/angular-cli/releases:

新的配置格式.可以在angular.json中找到新文件(但也可以使用.angular.json).在CLI 1.7项目上运行ng update将使您转到新配置.

New configuration format. The new file can be found at angular.json (but .angular.json is also accepted). Running ng update on a CLI 1.7 project will move you to the new configuration.

我需要执行:

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

这删除了.angular-cli.json并创建了angular.json.

如果这导致使用1.7.4的项目,请在本地安装v6:

If this leads to your project using 1.7.4, install v6 locally:

npm install --save-dev @angular/cli@v6.0.0-rc.4

并再次尝试使用以下方法更新您的项目:

And try once again to update your project with:

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

这篇关于错误:找不到本地工作区文件('angular.json')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆