The serve command requires to be run in an Angular project, but a project definition could not be found

 
The serve command requires to be run in an Angular project, but a project definition could not be found.
 
Are you getting error, “The serve command requires to be run in an Angular project, but a project definition could not be found” when running ng server command? This error often occurs when a project you are running is not an Angular project. It may also be the case when you download an Angular project but do not have latest dependencies installed on your machine. Installing latest dependencies should fix the problem.
 
This error you may get when running a terminal command ng server or ng serve --live-reload=true
 
The exact error is: The serve command requires to be run in an Angular project, but a project definition could not be found.
 
You can fix this error by running the following command:
 
ng update @angular/cli --migrate-only --from=<WhateverVersionYouAreCurrentlyOn>
 
For example, if you are on version 1.7.3, here is the command:
 
ng update @angular/cli --migrate-only --from=1.7.3
 
In your case, you may want to change the version 1.7.3 the current version you’re running.
 
If you want to force the update, you may want to try the following command.
 
ng update --all --force