Error: Local workspace file ('angular.json') could not be found

Pradeep picture Pradeep · Apr 13, 2018 · Viewed 258.7k times · Source

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

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

Answer

Lenni picture Lenni · Apr 13, 2018

I just had the same problem.

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

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.

I needed to execute:

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

This removed .angular-cli.json and created angular.json.

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

npm install --save-dev @angular/[email protected]

And try once again to update your project with:

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