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.
Also make sure if you are running ng serve that you stop it first...
Happened to me when didn't install angular core:
So I run
which gave me ng -v
Then I run
removed node_modules
And it worked!
It was happening in my existing project as I tried to update to latest
node
andnpm
packages:npm uninstall -g angular-cli
npm cache clean
ornpm cache verify
(fornpm version
> 5)npm install -g @angular/cli@latest
to reinstall back freshly the application is way better rather than update or editing some config that is not recognize by npm due to missing config or we are not really sure what is wrong.
I choose @Tinu solution is work
Step 1) npm install -g @angular/cli
Step 2) ng new my-angular-project
Step 3) cd my-angular-project
Step 4) ng serve --open
just made backup for our current source code and put it back to new angular project that be created.
This fixed my problem:
Finally, the command below fixed the issue for me!