npm link, nested dependencies, and semver

271 views
Skip to first unread message

Andrew Petersen

unread,
Aug 19, 2013, 1:34:21 PM8/19/13
to nod...@googlegroups.com
Is there a way to force `npm link` to not require also calling `npm link <package>` within a dependency of a package?

If I have a few local-only modules with dependencies, such as:

mod1, v1.34.2

mod2, v0.2.3
  mod1: "1.x"

mod3, v0.3.4
  mod1: "1.x"
  mod2: "0.2.x"

appmod v1.4.2
  mod1: "1.x"
  mod2: "0.2.x"
  mod3: "0.3.x"

Even if I go into each root module and call `npm link <dependency>` (for each dependency, of course), `npm install` within appmod will fail, I believe, I due to the nested dependency of mod1 within mod2 and mod3. In addition, because I've specified "1.x" as the dependency version, none of the modules that depend on mod1 "1.x" will resolve to an `npm link`ed version of mod1. It's only when I specify the exact linked version in all of their manifests, 1.34.2, that modules resolve.

Is there an easier way to get what I want without using relative paths? While I've changed the names here, this is a real scenario due to legacy code, and is not contrived. It seems silly that I would have to go and `npm link` into each module's node_modules folder recursively.

I've also tried specifying the dependencies as peerDependencies, but that seems to have the same effect: node cannot resolve the nested dependencies.

Any ideas? Would more code help people understand what I'm trying to do?

George Stagas

unread,
Aug 19, 2013, 9:28:41 PM8/19/13
to nod...@googlegroups.com
For a case like this you could try using this tool https://github.com/stagas/npm-server so that it installs your local modules as real ones during development.


2013/8/19 Andrew Petersen <senof...@gmail.com>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Andrew Petersen

unread,
Aug 20, 2013, 1:54:29 AM8/20/13
to nod...@googlegroups.com
Thanks! That's a neat package. I tried it out, works well!

My core problem still remains, which looks like it might be a bug deep within browserify, so I'll have to make some sort of simplified test case before getting more help.

But thanks for recommending npm-server, that's really useful for pretending to have a private npm repo.

Yip yip,
~ Drew*


You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/6HCoH8XswdY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages