You have to be inside an angular-cli project in order to use the build command after reinstall of angular-cli

I had the latest angular-cli installed globally and my project was building successfully.

While reading a suggested solution for another issue, (https://github.com/angular/angular-cli/issues/917) I uninstalled the global angular-cli and installed it as a dev-dependency.

That other issue wasn't solved so I uninstalled the dev-dependency and reinstalled angular-cli globally once again. Now when I try to do an ng build I'm getting the error:

You have to be inside an angular-cli project in order to use the build command

My angular-cli version did not change. Why isn't my project being recognised as an angular-cli project??


Same as John Pankowicz answer, but in my case I had to run

npm install -g @angular/cli@latest

for the versions to match.


npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli

use sudo on Mac/Linux.


Ok, found it.

package.json must contain a dependency to angular-cli.

When I uninstalled my local angular-cli, npm also removed the dependency entry.