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

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-devkit/core

npm install -g @angular/cli

npm install @angular/cli

ng update @angular/cli


Thanks

Comments

Popular posts from this blog

Swagger for Azure functions: Undocumented TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body. Fixed.

Fixed: The required column was not present in the results of a 'FromSql' operation in asp.net core EF core

Severity Code Description Project File Line Suppression State Error Unable to resolve dependencies. 'Xamarin.Android.Support.Design 24.2.1' is not compatible with 'Xamarin.Forms 2.3.3.180 constraint: Xamarin.Android.Support.Design (= 23.3.0)'. 0