Installing a local module using npm? Installing a local module using npm? javascript javascript

Installing a local module using npm?


you just provide one <folder> argument to npm install, argument should point toward the local folder instead of the package name:

npm install /path


From the npm-link documentation:

In the local module directory:

$ cd ./package-dir$ npm link

In the directory of the project to use the module:

$ cd ./project-dir$ npm link package-name

Or in one go using relative paths:

$ cd ./project-dir$ npm link ../package-dir

This is equivalent to using two commands above under the hood.


Since asked and answered by the same person, I'll add a npm link as an alternative.

from docs:

This is handy for installing your own stuff, so that you can work on it and test it iteratively without having to continually rebuild.

cd ~/projects/node-bloggy  # go into the dir of your main projectnpm link ../node-redis     # link the dir of your dependency

[Edit] As of NPM 2.0, you can declare local dependencies in package.json

"dependencies": {    "bar": "file:../foo/bar"  }