Do you want to request a feature or report a bug?
Feature
What is the current behavior?
The following prints on linux:
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
What is the expected behavior?
Yarn should suppress this message when verbose flag is not passed, as it's provides no feedback and only confuses users new to npm/yarn (I had to explain to someone that it's a harmless warning)
Please mention your node.js, yarn and operating system version.
yarn 0.19.1, node 6.9.4, linux
yarn --ignore-optional --ignore-platform ?
Why would you want to type that every single time you run yarn?
I tried putting the following in ~/.yarnrc, .yarnrc in project folder, and even in yarn lock:
ignoreOptional "true"
ignorePlatform "true"
ignore-optional "true"
ignore-platform "true"
None of them work. I didnt know these were CLI commands, so I guess my request is to make hide optionals default, and make it --show-optional-warnings
and hide platform errors if the dep is optional.
You wouldn't want to block all of these warnings, as you might try to actually use something thats not optional and you need to know.
but cases like fsevents is 100% useless to see it, and should be default to not see it.
Please add this to your roadmap as it is confusing to packager users to get spurious warnings. I've tried to get the warning hid by the node team with no success. See nodejs/node#7858
I'll add that there is an option to filter out optional, it just doesn't work with install
for some reason. See #2666
Discussion here https://github.com/yarnpkg/yarn/issues/3738
Note: --ignore-optional
is not a correct solution.
In case of fsevents (most common case) ignoring it causes very slow watching solution to be used instead on OS X. The desired behavior is to still install it when possible but not warn if not.
I only leave this comment here for future readers who might think --ignore-optional
is a good solution. Let's keep discussion in the other issue.
I am really tired of seeing this useless fsevents
warning year after year. It is not even relevant or useful or a warning on any platform except MacOS. If your OS is not MacOS then not installing this is expected and correct behavior and so nothing to WARN anyone about.
This situation pushes people to filter out all warnings or use --ignore-optional
because of this erroneous warning. It is so prevalent it practically deserves special-case code to suppress it! It causes build failures and we end up with special wrappers to grep it out. 馃槥
2020 checking in, this is still a frustrating thing
Still waiting on either npm or Yarn to allow gating a dependency based on OS. 馃槈
Not a dev of either, obviously.
I think currently we can use a workaround like alias:
alias yarn='yarn --ignore-platform'
I tested with --ignore-platform and it doesnt show warning about the fsevents
echo '--ignore-platform true' > .yarnrc
Yeah @ctrongminh @andreyors, I don鈥檛 love it, but is the best option available to users to address these erroneous warnings.
Most helpful comment
I am really tired of seeing this useless
fsevents
warning year after year. It is not even relevant or useful or a warning on any platform except MacOS. If your OS is not MacOS then not installing this is expected and correct behavior and so nothing to WARN anyone about.This situation pushes people to filter out all warnings or use
--ignore-optional
because of this erroneous warning. It is so prevalent it practically deserves special-case code to suppress it! It causes build failures and we end up with special wrappers to grep it out. 馃槥