Skip to content
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

Adds better support for node-gyp #35

Merged
merged 5 commits into from
Mar 23, 2019

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Mar 23, 2019

Some packages (for example sharp) don't list node-gyp in their dependencies even though they need it to build themselves. The reasoning they invoke is that node-gyp only is needed for some users. I don't agree with this assessment (if only because I'm running a regular OSX install and it doesn't seem to have prebuilt packages), but that's not a battle I want to start right now 🙂

Anyway, the previous fix was to manually edit the yarn.lock in order to manually add a dependency to node-gyp to the sharp package entry. It worked just fine, but was a bit hard to find for people not well versed in Yarn's internals - plus you'd have to do it every time you upgrade sharp.

Simultaneously, I didn't want to automatically install node-gyp when it is used, or use the global one. These patterns are non-deterministic, dangerous, and go against the principle of a lockfile.

This diff is a compromise: instead of crashing and letting the user find what to do by themselves, we now print an helpful error message. Additionally, we allow node-gyp to be executed from the root of the project - meaning that users only have to run yarn add node-gyp at the root of the project for everything to be built as expected.

@arcanis arcanis merged commit 05a014c into yarnpkg:master Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant