I ran npm install
for a lot of packages, but I forgot to include the --save
argument. Now when I try to deploy on Heroku I get errors for missing certain dependencies. How can I automatically add those dependencies to my package.json
file without doing npm install --save
for each one?
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.
Delete the package.json
and run npm init
in order to create a new package.json
including the modules installed without --save
in dependencies
.
Merge the dependencies of your newly created package.json
into your old one manually. Restore your merged package.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With