-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
yarn --ignore-optional does not work properly #5878
Comments
Yarn still has to be able to pull the metadata for the package to determine where it would be installed in node_modules if it were there and put it in the lockfile and get hoisting correct. This is basically the same as npm will completely ignore them, but also means npm is not deterministic (the result of an install may have different versions or hoist locations if the optional package was or wasn't available), so if this is a deal-breaker for you, you might actually want to use npm instead. |
For reference, #3630 That issue was left open, so maybe we should with this one too. Although "fixing" it would, I think, fundamentally break deterministic builds and it unlikely to actually change. |
@rally25rs i hear you on it breaking deterministic builds, thats why i think the pref should be saved per package (somehow, maybe in lock file). That way if optionals are ignored, they are ignored forever, and if the pref changes it would require dependencies to be resolved again. I think this would still preserve the goals of yarn and still allow me to install the package i want to install :) |
@rally25rs so the point i'm making is that |
Hi Adding to the thread. I'm behind a corporate firewall, experiencing a somewhat similar problem when trying to add a global package. Executing: Results in: Environment: Workaround: |
Yeah, I still don't think the statement "fundamentally breaks deterministic builds" makes sense. This is an optional package, all of the software can function without this package in perpetuity. If you want to permanently exclude this optional package, there is no reason to resolve it. |
Even if yarn tries to load metadata - in the end it shouldn't bail out with an error if it fails to do so for optional dependencies. |
It would be nice to find away to make this work. I have a number of private packages that are used in a mono-repo which are not published to any repository any where. They are listed in the optionalDeps in the package.json but when I try to install in my Dockerfile it fails. I feel like running the combination Or even better a |
Any update? |
Would love to see this. |
Do you want to request a feature or report a bug?
bug.
What is the current behavior?
if i run
yarn --ignore-optional somepackage
I will get an error and unable to installsomepackage
if it depends on a private dependency that has been marked as optional.If the current behavior is a bug, please provide the steps to reproduce.
yarn add --ignore-optional wix-storybook-utils
What is the expected behavior?
installs the package. Saves the pref so other people can install it too by running
yarn install
.Please mention your node.js, yarn and operating system version.
OS X, yarn 1.6.0, node v9.11.1
The text was updated successfully, but these errors were encountered: