Local workspace file (‘angular.json’) could not be found.

Read Time:1 Minute, 21 Second

After upgrading Angular application using ncu -a, got an error message Local workspace file ('angular.json') could not be found.</code.

$ ncu -a
$ npm run build

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (/srv/project/node_modules/@angular/cli/models/workspace-loader.js:44:19)
    at WorkspaceLoader.loadWorkspace (/srv/project/node_modules/@angular/cli/models/workspace-loader.js:31:21)
    at BuildCommand._loadWorkspaceAndArchitect (/srv/project/node_modules/@angular/cli/models/architect-command.js:189:32)
    at BuildCommand.<anonymous> (/srv/project/node_modules/@angular/cli/models/architect-command.js:55:25)
    at Generator.next (<anonymous>)
    at /srv/project/node_modules/@angular/cli/models/architect-command.js:14:71
    at new Promise (<anonymous>)
    at __awaiter (/srv/project/node_modules/@angular/cli/models/architect-command.js:10:12)
    at BuildCommand.initialize (/srv/project/node_modules/@angular/cli/models/architect-command.js:54:16)
    at Object.<anonymous> (/srv/project/node_modules/@angular/cli/models/command-runner.js:101:23)


To resolve the issue, run ng update @angular/cli

$ ng update @angular/cli

            Updating karma configuration
            Updating configuration
            Removing old config file (angular-cli.json)
            Writing config file (angular.json)
            Some configuration options have been changed, please make sure to update any npm scripts which you may have modified.
DELETE angular-cli.json
CREATE angular.json (5729 bytes)
UPDATE karma.conf.js (1052 bytes)
UPDATE package.json (3041 bytes)
UPDATE tsconfig.json (407 bytes)
UPDATE tslint.json (2927 bytes)



References: https://vitalflux.com/upgrade-angular-5-app-angular-6/


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.