By default of NPM is installing the modules under \"node_modules\". Is there a way to change it to be for example \"my_modules?
The standard for all node modules is to use the node_modules
directory.
Do not try to go against this uniform standard.
What are you trying to accomplish by customizing the directory?
Note:
The following command will install a module to my_project/node_modules/some_module
[~/my_project] $ npm install some_module
If you'd like to install modules and have them globally available on your system, you can use the --global
(-g
) flag
[~/my_project] $ npm install -g some_module
Packages installed with the -g
flag are installed to ~/.npm
Per your comment, you can attempt to install any directory that contains a package.json
file
[~/my_project] $ npm install /path/to/my/pkg
Alternatively you can install a symbolic link instead of copying the entire module to your ~/my_project/node_modules
directory.
[~/my_project] $ npm link /path/to/my/pkg
For more info about this:
$ npm help install
$ npm help link