0

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?

3 Answers 3

3

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
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Ritesh for ur help.Yes ,I have package.json file is present inside the ClientApp folder. Is npm install & npm i are similar command?
yes they are same.
Will npm i ,install all dependancy involved package.json.Will it not include devdependancy?
it will install all the dependencies.
0

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

Comments

0

Uninstall node_modules, restart your system and run

npm install

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.