How can I install a local npm module?

I have a repository for a module that I’ve downloaded and would like to install it in my local environment instead of globally or in a different directory. What is the simplest method to achieve this?

One straightforward way to install a local npm module is by using npm’s link feature. First, navigate to the directory containing your module and run npm link. This creates a global symlink to the module. Next, switch to the project directory where you want to use the module, and run npm link <module-name>. This command will create a link to your local module in the node_modules directory of your project. This method allows you to test changes in your module instantly in any project linked with it.

You can also use the file path option with npm install like npm install ./path/to-your-module, which installs it directly from the file system. Just remember to be in the projet dir where you want it installed. It’s simple and avoids any global changes.