npm install --save
You can add all installed packages not installed with
--save to your
package.json automatically by calling
npm init. It will append the dependencies to your existing ones. No settings in your file should be lost. Still don't forget to make a backup of the file to be 100% secure!
If the dependencies have not been appended, it can happen that just the merging failed:
Backup your existing
package.json in order to keep the dependencies you have in your
package.json already and all the other settings. We need this file later again.
package.json and run
npm init in order to create a new
package.json including the modules installed without
Merge the dependencies of your newly created
package.json into your old one manually. Restore your merged