0

Today I checked my angular version by using

ng -v 

It showed

Angular cli 1.0.0-beta.28.3

I uninstalled this version using

npm uninstall -g angular-cli


npm uninstall --save-dev angular-cli 


rmdir -rf node_modules dist 
npm cache clean -- force

Then I installed node js new version 12.18.1 . Later I installed new version i.e. 9 version of angular using this .So currently I have version

     Angular CLI: 9.1.9
        Node: 12.18.1
---------------------------------

Then I ran on my node terminal the following commands

npm install -g @angular/cli@latest
npm install --save-dev @angular/cli@latest

And at the end using

npm install

When I run the angular project I get the error The serve command requires to be run in an Angular project,but a project definition could not be found.

I have checked over stack overflow and found that I should use npm start but I want to keep using ng serve.I can't migrate to higher version because its version 9 with me now.Should I uninstall angular again.but I tried it several times and still I'm getting the same error. Please help me .

P.s. sorry everyone I'm repeating the question on stack overflow but I need help , and other answers are not solving my error.

Thanks

  • 2
    Duplicate [here](https://stackoverflow.com/questions/53096996/angular-cli-error-the-serve-command-requires-to-be-run-in-an-angular-project-b) – Son Nguyen Jun 18 '20 at 12:57
  • 1
    Does this answer your question? [Angular CLI Error: The serve command requires to be run in an Angular project, but a project definition could not be found](https://stackoverflow.com/questions/53096996/angular-cli-error-the-serve-command-requires-to-be-run-in-an-angular-project-b) – Norbert Bartko Jun 18 '20 at 12:58
  • In the solution provided I have tried `ng update --all --force` but I got `Using package manager: 'npm' Collecting installed dependencies... Found 0 dependencies.` I even tried `npm install` again Also I want to use this command `ng update @angular/cli --migrate-only --from=` but I dont know how to use it for angular 9 please help. thanks – FlyingBird Jun 18 '20 at 13:23
  • I tried `ng update @angular/cli --migrate-only --from=9.1.9` and I got the message `Using package manager: 'npm' Collecting installed dependencies... Found 0 dependencies.` – FlyingBird Jun 18 '20 at 13:30
  • I tried a suggestion in the above link that said to upgrade the angular version i.e. [link](https://update.angular.io/) but I'm getting the below error `Using package manager: 'npm' Collecting installed dependencies... Found 0 dependencies. × Migration failed: Could not find a package.json. Are you in a Node project? See "C:\Users\Admin\AppData\Local\Temp\ng-5B0Bkr\angular-errors.log" for further details.` .Please help my problem is different – FlyingBird Jun 18 '20 at 13:38
  • Just to check - are you running the ng serve command under the folder where package.json file exists ? – sunilbaba Jun 18 '20 at 16:04
  • yes I'm running ng serve under the folder where package.json exists .I tried running in src folder also ,but it is not working.Before ng serve would work under the folder with package.json file.Please help – FlyingBird Jun 18 '20 at 16:51

0 Answers0