The serve command requires to be run in an Angular project, but a project definition could not be found - Fixed
Error - The serve command requires to be run in an Angular project, but a project definition could not be found
npm install -g @angular-devkit/core
npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli
Root Cause - When there is no project definition file in your project then you will see this error when you will run ng-serve or ng-build commands.
Project definition file - In Angular project definition file is generated when you create new application or upgrade existing application. In Angular versions lesser than 6 this file name is .angulat-cli.json and in Angular version 6 and above it's name is angular.json .
Solution - So while running the angular build or run commands make sure you have correct project definition file. If you are upgrading your application from Angular 5 or lesser versions to Angular 6 and greater versions then you need to run below command to generate new project definition and other related files.
ng update @angular/cli // run it twice,
If it's not generating then again try to run below commands in same sequence.
npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli
Thanks
Comments
Post a Comment