I have some module in my node_module folder but because I am amateur in nodejs
, when I wanted to install theme, I forgot to use --save
with npm i
Simply change into the directory containing node_modules
, backup any existing package.json
in there, then use npm init
to re-create the package.json
.
The generated package.json
will include any modules that already exist within node_modules
.
Sample run:
$ cd /my/project
$ mv package.json package.json.bak # Backup package.json
$ npm init # Recreate package.json with dependencies populated