Installing a local module using npm?

fancy picture fancy · Nov 11, 2011 · Viewed 262.1k times · Source

I have a downloaded module repo, I want to install it locally, not globally in another directory?

What is an easy way to do this?

Answer

Rich Apodaca picture Rich Apodaca · Sep 13, 2013

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.