Error: Local workspace file (‘angular.json’) could not be found
Why is it?
If you run into this issue, it’s probably because your global @angular/cli , project @angular/cli version or @angular/compiler-cli doesn’t match.
Debug
First of all run
ng -v
to check the global version (i.e it outputs 5.2.0) and then look into your project package.json, if it match with the project versions.
... "@angular/cli": "6.0.0-rc.3", "@angular/compiler-cli": "^5.2.0", ...
Fix it
If something doesn’t match, update or downgrade it. For example to downgrade project @angular/cli run
npm uninstall -D @angular/cli npm install -D @angular/cli@5.2.0
To upgrade global run @angular/cli run
npm install -g @angular/cli@latest
Note
It is necessary to have both a global and local install for the tools to work.
In global mode (-g or –global appended to the command), it uninstalls/installs the package as a global package. To uninstall/install the project package use -D or –save-dev and package will be removed/added to your devDependencies.
The @ after package name specifies the desired version.