Dependent Package Not Found

From I run:

var assertThrows = require("@kingjs/assert-throws")

Which unexpectedly fails with “Error: Cannot find module ‘@kingjs/assert’”

@kingjs/packages depends on:

  • @kingjs/assert and
  • @kingjs/assert-throws

@kingjs/assert-throws requires but does not include it in it’s list of dependencies:

  • @kingjs/assert

I figured when @kingjs/assert-throws tried to load @kingjs/assert it would succeed because @kingjs/packages depended on it. But didn’t work…

Unfortunately I’m unable to replicate the behavior you saw because @kingjs/packages has a reference error immediately after the requires resolve:

- Randy

Randy, I’ve got another reproduction.

I expect the code to run as is but I actually need to un-comment the require('@kingjs/define-generator'); line.

Sorry about that last one. I pushed a fix which broke the reproduction.

Cool, thanks for following up. The issue here appears to just be that you didn’t add @kingjs/define-generator to the dependencies in the package.json:


If package A depends on package B which depends on package C, then I expected A’s package.json to only list B in its dependencies and yet still be able to load B successfully because I expected RunKit to walk the poset of dependencies, discover C, and ensure it’s available before launching A.

Is this not preferable?

Otherwise A has to include the closure of all its dependencies to get RunKit support even though locally its not required as NPM installs the closure for me.

Oh, my bad… I didn’t see that it was a different linq package bringing in define-generator. You’re right RunKit should (and will) crawl the dependencies, however linq.concat also doesn’t include genie-generator as a dependency (only a devDepenedency):

Ah! Thanks so much for tracking that down!

So, devDependencies are EVIL!