Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to Add my node_module, modules into package.json

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 install.now I have lots of module but my package.json is empty so is there any way to add theme into package.json.
Sorry if my question is silly one I am beginner in nodejs

like image 503
Daniel.V Avatar asked Jul 26 '15 11:07

Daniel.V


People also ask

Can I manually add to package json?

You can add dependencies to a package. json file from the command line or by manually editing the package.

Where do I put node modules?

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node.


1 Answers

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
like image 135
yjwong Avatar answered Sep 17 '22 20:09

yjwong