1

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.

  • there is a flag --no-bin-links that prevent creating links only to bin's files

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.

2
  • honestly you're probably better off just publishing a scoped package to NPM so you can reference the specific version. Using 0.0.* version numbers is a good way to flag that a package is in development. Commented Mar 20, 2018 at 3:10
  • @zzzzBov thanks but the whole point is to work on my module offline :P Commented Mar 20, 2018 at 3:17

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.