小编典典

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

all

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

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

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 片段以更好地了解运行环境:

    "@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",

阅读 174

收藏
2022-07-08

共1个答案

小编典典

我只是有同样的问题。

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

新的配置格式。可以在 angular.json 中找到新文件(但也接受 .angular.json)。在 CLI 1.7 项目上运行 ng update
会将您移至新配置。

我需要执行:

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

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

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

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

并再次尝试更新您的项目:

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