Hassan
Hassan

Reputation: 417

NodeJS - installing local module

npm i /path/to/module/folder will create a dependency for your project on local module
it creates a link to that folder as the docs says

npm install < folder >:

Install the package in the directory as a symlink in the current project. Its dependencies will be installed before it's linked. If sits inside the root of your project, its dependencies may be hoisted to the toplevel node_modules as they would for other types of dependencies.

What i want is : is there a way to be able to make dependency on that local module by copy it not link it, so i can make changes and won't reflect on other projects until i manually npm update my-local-module it


PS : from what i searched that was the default behavior of npm install <folder> but they changed it.

Upvotes: 1

Views: 708

Answers (1)

Carloluis
Carloluis

Reputation: 4320

You can create a tarball from your-local-module with npm-pack and then install it offline using npm-install:

npm install <tarball file>

Install a package that is sitting on the filesystem. Note: if you just want to link a dev directory into your npm root, you can do this more easily by using npm link. The filename must use .tar, .tar.gz, or .tgz as the extension.

Upvotes: 2

Related Questions