Skip to content

Instantly share code, notes, and snippets.

@tamzinblake
Created September 23, 2016 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamzinblake/b90e699f76f1cc28e91299b340da588e to your computer and use it in GitHub Desktop.
Save tamzinblake/b90e699f76f1cc28e91299b340da588e to your computer and use it in GitHub Desktop.
A trick for developing npm dependencies

If you don't want to go through the trouble of managing npm link you can call your development directory node_modules, like so:

$ mkdir node_modules
$ cd node_modules
$ git clone project1
$ git clone project2

Now if project1 has a dependency on project2 but you want to develop against your local version:

$ cd project1
$ npm uninstall project2

Now when node tries to resolve the project2 dependency in project1, it will walk up the directory tree to your cleverly-named node_modules and find the dependency it's looking for. When you want to use the published version again, just go into project 1 and npm install again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment