-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.3-beta.11] Can't depend on the pkginfo
npm package or any package that uses it
#6313
Comments
Apologies in advance for the wall of text. This issue provides an excellent example of a category of npm packages that are difficult (but not impossible!) to use outside of Node, so I'm going to explain all the background (and some potential solutions) in as much detail as I can. Don't feel obligated to read or respond to all of this; the tl;dr is that we're working on the challenges posed by packages like So, what exactly is going on here? The In other words, Why can't Meteor expose real, absolute file system paths via With all of that background explanation out of the way, what can we do about
Thanks for reading this far, and thanks for putting this issue on our radar! |
Thanks for the explanation @benjamn. I have a potential pull request here that seems to work: indexzero/node-pkginfo@master...aldeed:master Can you review it? I would like to add one or more tests to pkginfo to prove this works, too, but I'm not quite expert enough in requirejs to replicate what Meteor is doing. Can you let me know what a proper test would be? I noticed that sometimes |
Awesome! This PR looks good to me, though I would change this line throw new Error('Could not find package.json up from /'); to be a little more descriptive: throw new Error('Could not find package.json up from ' +
(pmodule.filename || pmodule.id)); (I know you were just trying to keep the original behavior.) |
The change in pkginfo is a fix for a problem when using inside Meteor app. meteor/meteor#6313
Reproduction app: https://github.com/aldeed/13test
To reproduce:
npm install
meteor
The error message:
This error happens simply by doing
import 'pkginfo'
somewhere in the app. It also happens with any other package that depends onpkginfo
, which seems to be many. I initially saw this when importinglogstar
, which importswinston
, which importspkginfo
.I don't know enough details about how the npm imports work in 1.3, but it seems maybe related to the fact that npm packages used by Meteor packages are not in the same directory as npm packages used by the app.
The text was updated successfully, but these errors were encountered: