Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAedrian Escultura
2,231 Pointsng serve -o is not working
I downloaded the project files, extracted them, and then ran npm install.
Next I tried to run "ng serve -o" but I am getting this error:
The serve command requires to be run in an Angular project, but a project definition could not be found.
When I run "npm run serve", I am able to access the app from http://localhost:8080. Should this project run on a specific angular cli version?
3 Answers
Liam Clarke
19,938 PointsHi Aedrian
Firstly have you install angular-cli globally? make sure you cd into the project where the angular app was created then try ng serve -o
If the above doesn't work, I have had similar issues with another tool, the way I fixed this was updating to the latest version.
Aedrian Escultura
2,231 PointsHi Liam,
Thanks for the response. Yes, angular-cli is installed globally and on 7.3.3 which is the latest version. I am also running ng serve -o on the project directory (where I also ran npm run -serve and that one worked).
Liam Clarke
19,938 PointsHi Aedrian,
Can you check that in your project you have angular.json file and package.json file.
If you have angular-cli.json then you will need to migrate your project to the latest version
You'll find how to do this here, each project is different so fill in the information and it will give you a step by step guide on how to upgrade.
Once you've done that you will possibly need to clear your cache