Installing a local module using npm?


Question

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?

1
347
1/27/2017 4:47:34 PM

Accepted Answer

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

npm install /path
351
3/16/2019 2:37:22 AM

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.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon