-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Not fully compatible with yarn package manager #7
Comments
This is a bug in yarn's interaction with platform-dependent-modules. If you know of another way to have platform-specific dependencies, I'd appreciate any suggestions. |
It's not a bug of yarn, it is an expected behaviour. "optionalDependencies": {
"exiftool-vendored.pl": "10.51.0",
"exiftool-vendored.exe": "10.51.0"
} Package managers (npm or yarn) will not install modules which aren't compatible with the current platform os. So on a target platform only one of that modules will be installed. |
I actually used this approach in versions prior to v1.5.3, see 3690c73#diff-b9cfc7f2cdf78a7f4b91a753d10865a2. This post highlights a defect with this approach: if the dependency fails to install, npm just reports it as a warning and carries on. This issue in yarn is somewhat related. |
I don't understand what the problem was with that solution. It seems working as expected with both of yarn and npm:
am@135775:/srv/nodejs/qaa1nd07/base$ npm i
qaa1nd07-base@0.1.0 /srv/nodejs/qaa1nd07/base
└── qaa1nd07-dep-linux@0.1.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: qaa1nd07-dep-win32@^0.1.1 (node_modules/qaa1nd07-dep-win32):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for qaa1nd07-dep-win32@0.1.1: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN qaa1nd07-base@0.1.0 No description
npm WARN qaa1nd07-base@0.1.0 No repository field. If only problew was
Then postinstall hook can verify that one was installed and throw error if not. |
NICE! I didn't even think about doing a validation step in the postinstall. Do you want to make a PR for this, or wait for me to do it? Thanks! |
PR is ready |
Thanks for your help. Travis now runs the builds with yarn, and I'll release this version tomorrow. |
index.js
includes only import ofexiftool-vendored
moduleWorks ok only on clean install or if
exiftool-vendored.pl
explicitly added as a package dependency.This does not cause much inconvenience in a case of
exiftool-vendored
is a direct dependency. But it is not so if there are intermediate dependencies.For example
module-a -> module-b -> exiftool-vendored
. Whenever amodule-a
adds a new dependency,mobule-b
will throw an error.The text was updated successfully, but these errors were encountered: