When you create an application or a simple js file which requires node modules to be required, for the first time you need to install all the modules explicitly and individually and also save it to the package.json. This module will save your time and install all the modules required for your js file to run and save it to package.json If there doesnt exist a package.json, it creates it and saves the dependencies there. It works for a folder too which contains n number of js files.
I've never been in a scenario where I had a project that
1) required dependencies that weren't installed explicitly
or
2) weren't declared in the package.json
How does this situation even happen?