Error: Local workspace file ('angular.json') could not be found
Solution 1:
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
Solution 2:
I was getting the same error messages. It was a silly mistake on my end, I was not running ng serve
in the directory where my Angular project is. Make sure you are in the correct directory (project directory) before running this command.
Solution 3:
With recent version, without --migrate-only
I got the repo updated.
I did ng update
The Angular CLI configuration format has been changed, and your existing configuration can be updated automatically by running the following command:
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 (3684 bytes)
UPDATE karma.conf.js (1040 bytes)
UPDATE src/tsconfig.spec.json (322 bytes)
UPDATE package.json (1340 bytes)
UPDATE tslint.json (3140 bytes)
Solution 4:
Well, I faced the same issue as soon as I updated my angular cli
version.
Earlier I was using 1.7.4 and just now I upgraded it to angular cli 6.0.8
.
To update Angular Cli global:
npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
To update Angular Cli dev:
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
To fix audit issues after npm install:
npm audit fix
To fix the issue related to "angular.json":
ng update @angular/cli --migrate-only --from=1.7.4