Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Created May 18, 2012 22:19
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 aaronj1335/2727870 to your computer and use it in GitHub Desktop.
Save aaronj1335/2727870 to your computer and use it in GitHub Desktop.
npm link issue
[me@laptop:code/] $ cd A
[me@laptop:code/A] $ npm link # this works as i expect (and want)
[me@laptop:code/A] $ ll /usr/local/lib/node_modules
...
lrwxr-xr-x 1 me admin 22 May 18 16:59 /usr/local/lib/node_modules/A -> /Users/me/code/A
...
[me@laptop:code/A] $ cd ../B
[me@laptop:code/B] $ cat package.json
...
"dependencies": {
"A": "0.0.x"
}
...
[me@laptop:code/B] $ npm install --link
[me@laptop:code/B] $ ll ./node_modules # this also works as i expect
...
lrwxr-xr-x 1 me admin 22 May 18 16:59 node_modules/A -> /usr/local/lib/node_modules/A
...
[me@laptop:code/B] $ ll /usr/local/lib/node_modules # global link has been replaced with static install
...
drwxr-xr-x 1 me admin 22 May 18 16:59 /usr/local/lib/node_modules/A
...
@aaronj1335
Copy link
Author

I'm developing on both A and B, so if I blow away B, re-clone and run npm install --link, I want it to link to the global package A, and maintain that global link from the prefix to my A repository.

If I run npm link A from within B, this works, but that loses the convenience of declaring the dependencies in package.json. I could also write a script to just do this, but once again, that loses the convenience that makes npm install so great.

@isaacs
Copy link

isaacs commented May 19, 2012

This looks like a bug. Please post it at https://github.com/isaacs/npm/issues

@aaronj1335
Copy link
Author

aaronj1335 commented May 20, 2012 via email

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