I am very new to node.js and am following this tutorial
When I get to step 5, after completing step 1-4 successfully, and run the npm install command I get these errors. http://i.stack.imgur.com/LPN49.png Also when I run npm start command I get these errors in image 2 http://i.stack.imgur.com/TrOJz.png
Please help me rectify these errors.
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 installgoes 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 runnode /path/to/node/server/filethen Node and Express will start looking for dependencies that may not be there because yournpm installerrored out.Additionally, you can only use
npm startif the package.json file has a scripts property that tells node what start script to use. If it's not there, it falls back tonode 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 startbecause you didn't install Express's body-parser dependency, which prevented it from starting your server.