When running the terminal commands ng server
or ng serve --live-reload=true
, I'm getting this issue:
The serve command requires to be run in an Angular project, but a project definition could not be found.
When running the terminal commands ng server
or ng serve --live-reload=true
, I'm getting this issue:
The serve command requires to be run in an Angular project, but a project definition could not be found.
Please check whether you are inside your project folder or not and try the command
ng serve
againI got the same error since I tried
ng serve
command outside of my projectExample :: let's say you have a project with name "Ecommerce" traverse into the folder and try the command
ng serve
open terminal cd Ecommerce ng serveI faced the same issue when,
I had created new angular project using old angular-cli version (1.4.7) I then updated angular-cli using below commands (DO NOT DO THE BELOW TO UPDATE CLI)
npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli@latest
Now when I tried
ng serve
, i was getting same error like youDO BELOW TO UPDATE CLI
I came across the same error. The reason is that new angular cli update makes angular-cli.json redundant, and it is replaced with angular.json instead. My previous Angular Cli version is 1.7.4, so to make the change, I ran the following command, it will make the conversion for you:
This error occurs when the project you are running is not an angular project. Though you have downloaded an angular project but have not installed all the dependencies thats why the ng serve command is not available to you.
Just navigate to the path where the project is stored and use the command
(Note - Node.js should be installed in your system and if you are using Angular 2 or above angular cli should also be installed in your system before you run this command. To check if the node.js is installed n your system 1) Open cmd (any path- as node should be globally installed in your system) 2) use command
to get node and npm version)
One more important thing: The angular cli version won't make a difference if the version installed in your system is higher than the version required by the project. It will give a warning but you can ignore the warning.
I was also getting this issue and solved by running below command.
e.g.
getting ref from here https://github.com/angular/angular-cli/issues/12215#issuecomment-433593036
Tested in Angular 7+