As I started to develop my first nodejs express application, I added many packages with npm.
I would like to know if there is a way to generate a package.json file containing all the current dependencies or the list of the current packages under the nodes_modules directory.
Run
npm listto see what you have installed. Runnpm shrinkwrapto build anpm-shrinkwrap.jsonfile, which you can use as a starting reference to build a properpackage.json. My workflow is always to update package.json and then runnpm install. I never runnpm install footo get some package because it creates risk of forgetting to add it topackage.jsonand then having your application fail to start on deployment.Updated to add: These days I do run
npm install --save fooornpm install --save-dev foosince I have now decided the~0.4.3version numbers it adds topackage.jsonare better than my former preference for0.4.xsince the~gives you a more precise minimum version number.