Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
npm installs fibers once per dependent module... strangeness ensues #102
If I have a package that both depends on fibers and depends on a package that depends on fibers, I end up with two copies of fibers which seems to screw up Fiber.current because, I presume, there is more than one "global" Fiber object.
Hypothetical directory structure created by npm:
When I get a future from cot-fibers and try to wait within a fiber, I get "Can't wait without a fiber" even though I'm definitely within a fiber. If I delete the nested fibers install and try again, everything is fine.
Does this sound like a plausible issue? Or am I just doing something screwy?
If you look at the "Algorithm" section of the npm-install docs (https://npmjs.org/doc/install.html), it explains that sub-modules will only have their dependencies installed in their own node_modules directory if a module higher up doesn't already have that dependency.
I ended up with two copies of fibers because I did things in this order:
I imagine this is a fairly common mistake for anyone writing a module with fibers, and the error message when this happens isn't particularly helpful, so it probably could use some attention. But it was still somewhat a case of user error.