I have been assigned a task where I have to run ng serve command in folder.
I have installed node.js and checked it's version. Run this command npm install -g @angular/core @angular/cli
I have following folder structure.
ProjectFolder - > ClientApp - >Src
-> dist
-> e2e
I am running this command inside ProjectFolder and I am getting this error.The serve Command requires to be angular project but project definition could not found.
Is my path is wrong? In which folder shall I run this command ? ClientApp or Src?
If I make new project and serve this ng serve,it is working.
So I tried to run project inside ClientApp
When I am running ng serve inside clientApp,getting msg :An unhandled exception occurred:
Cannot find module
'@angular-devkit/build-angular/package.json' Require stack: .
So many error like AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js
\AppData\Roaming\npm\node_modules\@angular\cli\utilities\json-schema.js
AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
I have taken my project from live devops directory.
It don't have node_modules folder in project.
Do that folder is necessary?
Do I need run npm install command?
Inside which folder?ClientApp?
CodePudding user response:
Yes, you will need to install node modules inside ClientApp folder. Please make sure that you have package.json file is present inside the ClientApp folder.
Use below command inside the ClientApp folder to install node modules:
npm i
CodePudding user response:
You need this add angular to existing project as I doubt if your project is an angular project. If it is not, refer to this link.
Else, you may add another reference from your error solving by c-sharpcorner