How TO install a local module using npm

0 votes
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?
Jul 13, 2020 in Node-js by kartik
• 37,510 points
603 views

1 answer to this question.

0 votes

Hello @kartik,

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 .

Hope it helps!!
Thank you!!

answered Jul 13, 2020 by Niroj
• 82,880 points