You develop applications in the context of an Angular workspace. A workspace contains the files for one or more projects. A project is the set of files that comprise a standalone application or a shareable library. The Angular CLI ng new command creates a workspace.
You can use npm list -global to list all the component versions currently installed on your system. For viewing specific lists at different levels use --depth . Show activity on this post. Go to your folder path in cmd where your angular is installed and type ng --version it will show your angular version.
To get the application running, the ng serve command must execute within the [name-of-app] folder. Anywhere within the folder will do. The Angular CLI must recognize that it is within an environment generated with ng new . It will run provided this one condition.
I was also getting this issue and solved by running below command.
ng update @angular/cli --migrate-only --from=<WhateverVersionYouAreCurrentlyOn>
e.g.
ng update @angular/cli --migrate-only --from=1.7.3
getting ref from here
make sure that you are running the command in the application root folder..
if you have downloaded a project,do in the project
npm install
Finally, the command below fixed the issue for me!
ng update --all --force
Angular Cli Error: The serve command requires to be run in an Angular project, but a project definition could not be found
Problem was missing angular.json files.
ng update --all --force
Tested in Angular 7+
It was silly me but need to leave comment maybe I save someone else some hassle. Same message happens if you multitask and have multiple projects so some of project is nested inside project folder like projectFolder/subProject/projectOne
so I was in projectFolder/subProject
trying to run command ng serve
.
Make sure you are in correct folder because same error will occur if you are in wrong folder and conf and build is missing!
It was happening in my existing project as I tried to update to latest node
and npm
packages:
npm uninstall -g angular-cli
npm cache clean
or npm cache verify
(for npm version
> 5)npm install -g @angular/cli@latest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With