Search code examples
angularangular6npm-installng-upgradenpm-update

Error: Local workspace file ('angular.json') could not be found when upgraded to Angular 6


I have upgrading my project from Angular 5 to Angular 6. When I try to run the application using npm start it is throwing a below error.

enter image description here

I know that there is already questions like this that has answers, but I tried the most of them and those didn't work for me.


Solution

  • I was migrating from Angular version 5 to version 6. It came to my notice that angular 5 was using .angular-cli.json file whereas after migrate it to version 6 I found that that from Angular 6 version don't support .angular-cli.json file. So to make my project work I have migrated the .angular-cli.json file to angular.json. I used below command for the same.

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

    Then I followed below steps.

    1. I have removed my node_modules package from my application.
    2. Cleaned the cache using npm cache clean
    3. Verified the cache using npm cache verify
    4. Re-installed it using npm install

    After doing above steps it worked for me.