9

I have a simple question that i cant seem to find the answer for. I cloned a git repo to my local machine.

When attempting to start node, I receive an error because i don't have the required npm dependencies installed. However, they are located in the packages.json file that was cloned.

I was wondering if there was a simple way to install the dependencies located in that file, without having to npm install for every individual package.

5
  • 7
    npm install without arguments installs all modules in package.json. Commented Jul 16, 2018 at 16:57
  • @Phix I get errors when i try that....npm WARN Invalid version: "0.1" npm WARN server No description npm WARN server No repository field. npm WARN server No README data npm WARN server No license field Commented Jul 16, 2018 at 17:01
  • @Hysii Usually, warrnings are not equivalent to errors. Don't be afraid of warnings though - but it would be a better idea if you could provide a link to the package.json, if you're experiencing issues / errors while npm install. Commented Jul 16, 2018 at 17:05
  • Post your package.json file here. It'll be faster than assuming what it looks like. Commented Jul 16, 2018 at 17:37
  • Thanks for the help guys, at this point i just installed individual packages. I was pretty sure 'npm install' installed all dependencies, so thanks for confirming my preconceived assumption Commented Jul 16, 2018 at 18:04

1 Answer 1

12

Within the directory of the package.json file, just run npm install. It will read package.json and install all dependencies. If you want to limit it to only non-dev dependencies, use npm install --only=production.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.