-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added node-gyp to dependencies list #924
Conversation
Otherwise, an installation will fail on yarn unless node-gyp was installed globally via npm first. ``` [4/4] ⠁ sharp [4/4] Building fresh packages... error /Users/viatsko/projects/homepage/node_modules/sharp: Command failed. Exit code: 127 Command: sh Arguments: -c node-gyp rebuild Directory: /Users/viatsko/projects/homepage/node_modules/sharp Output: sh: node-gyp: command not found ```
Hello, thanks for this. Is having |
Hey, I've checked multiple packages and they were using node-gyp/node-pre-gyp as part of dependencies, e. g. https://github.com/nodegit/nodegit/blob/master/package.json The problem might also be related to the inconsistency of where yarn stores binary packages as I see that yarn tries to install node-gyp as well as a part of a process (probably, side-effect of having yarnpkg installed by multiple ways). But as adding to dependencies solves the problem for this case, I'd go for it. |
Thanks. yarnpkg/yarn#3240 suggests recent versions of yarn will attempt to auto-install |
Hi. As I said, it's kinda working, but then path of node-gyp installation is unpredictable if you have multiple yarn installs. While this is exceptional case, I'll leave up to you whether we can still help users with such an issue taking into account many other libraries keep node-gyp as a dep. |
Might those using multiple yarn installations be considered "power users"? I think I'd prefer to avoid adding a ~6MB dependency for everyone (sharp currently has ~2MB of dependencies, so this would represent a ~300% increase) for the sake of helping a few people who can probably work out what's wrong. Let's leave this open for now to gather further opinions. Thanks again for bringing this possible problem to my attention via a PR. |
There have been no further requests for this change and #186 removes the need for |
@lovell I stumbled upon exactly the same issue and I thought I was losing my mind. I am not exactly sure who's the one to blame (either yarn or or absence of node-gyp in sharp package) and I am not sure either why it works for npm, does it install node-gyp automatically? I don't know... I switched one of my projects to NPM because of this. Whooooa #186 fixes this! |
Hey @lovell! Would you consider reconsidering this?
|
@arcanis Hi Maël, thank you for helping to maintain yarn and continuing to improve dependency management tooling. As you've probably read above, the main reasons node-gyp isn't currently listed as a dependency of sharp are a combination of the assumption that package managers have been including it since time immemorial, I've yet to see a problem as a result of the "wrong" version of node-gyp, and ~90% of installs result in the use of prebuilt binaries so only a minority of users ever require it. A decision to include node-gyp as a dependency of sharp would be made much easier by a means of separating install-time dependencies from runtime dependencies. Is this something you're aware of for either yarn and/or npm?
Are you able to provide more details of this? |
I don't think we have this exact feature (the problem is that we already have {
"peerDependencies": {
"node-gyp": "*"
},
"peerDependenciesMeta": {
"node-gyp": {
"optional": true
}
}
} One potential issue is that because of its new peer dependency,
Sure, what info can I provide? I'm on Darwin 18.2, x86_64. This is the content of my sharp/vendor/lib folder: https://gist.github.com/arcanis/c04a5343b3d086efd9372e0bd2a7bf07 |
Oh, and I use various Node versions, usually cutting edge. At the moment I'm on 11.10. |
Otherwise, an installation will fail on yarn unless node-gyp was installed globally via npm first.