Normally I would execute:
npm install <package_name> --save
You can do
npm init to create
package.json file with all dependencies currently installed, added into it by default. I have npm version 2.11.3.
Earlier versions of npm used to create a
package.json file without the dependencies. If you are on such a version, run the below command to save the currently installed dependencies into it:
ls node_modules | xargs npm install --save
xargs will work only if you are on Linux / Mac OS X.