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

10.5k Views Asked by At

I have cloned one of my old project from github and tried to install node_module and found some vulnerabilities. To fix them I ran the following command

npm audit fix

there were still some more vulnerabilities, so I ran the forced fix command

npm audit fix --force

After that when I am trying to run the project I am getting this -

Error

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

3

There are 3 best solutions below

0
On

the reason is that the new @angular/cli form version 7, have an angular.json file instead of angular-cli.json in version 1.x.x you can fix that by running:

ng update @angular/cli --migrate-only --from=<Your_Angular_CLI_Old_Version>

it will replace angular-cli.json file by the new file

0
On

If you run ng serve -o in a command line as an administrator, you must insure that you are in the sub directory where your package.json is located, otherwise you will be encountered of such error message...

Happy coding...

0
On

The reason is that When you edit a component.cs/ component.html or any pages that are in your project and trying to run the project from different location of your project. So, go to your project folder and run the project using the command "ng serve"