Hubert OG
Hubert OG

Reputation: 19544

Package.json: dependency in a local directory?

I'm developing a npm package along with an application that uses it. I'm making a ton of small changes in this package and would like to be able to rerun the application after every iteration. The package is listed as a dependency in package.json file within the app.

Currently, I've got the dependency pointing to a branch in remote git repository, but I'd like to speed this process up and not have to push every change. Is it possible to list the dependency as a directory in local file system?

Upvotes: 1

Views: 4309

Answers (3)

Hubert OG
Hubert OG

Reputation: 19544

It turns out the easiest way to achieve this is to just link the package directory directly into node_modules.

cd node_modules
ln -is /path/to/package/directory packagename

Upvotes: 0

Jonathan Wiepert
Jonathan Wiepert

Reputation: 1242

As far as I know, you can't using package.json. Assuming your module is in /home/username/my_module, you can do this:

npm install /home/username/my_module

Upvotes: 0

sent1nel
sent1nel

Reputation: 1780

Try using npm link in the local directory. Should link your globally installed module to the local copy.

Upvotes: 5

Related Questions