I originally answered this question on Quora -- including an explanation about why the SO community frowns on this type of question -- but here's the technical portion if anyone comes to this question for a more general answer:
npm install
goes through the list of dependencies in your package.json file, fetches each one from NPM, then installs it locally for you. If there was an error with that process then you will be missing one or more dependencies -- if you try to run node /path/to/node/server/file
then Node and Express will start looking for dependencies that may not be there because your npm install
errored out.
Additionally, you can only use npm start
if the package.json file has a scripts property that tells node what start script to use. If it's not there, it falls back to node server.js
, which won't start your server if it's called something other than server.js. (For more information: node.js express npm start)
You should try to confirm whether your package.json is actually at the file path on the first "ERR!" line after you ran npm install. I'm guessing it didn't find the file so it couldn't install dependencies, and then you're getting an error from npm start
because you didn't install Express's body-parser dependency, which prevented it from starting your server.