沉默'info fsevents@1.2.4: The platform "linux" is incompatible with this module.'

Silence 'info fsevents@1.2.4: The platform "linux" is incompatible with this module.'

当运行yarn check时,我看到:

info fsevents@1.2.4: The platform "linux" is incompatible with this module.                                                                                                                                        
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.

This GitHub comment 表示可以安全地忽略该消息。

有没有办法从一开始就防止它发生?

目前似乎无法阻止有关未明确要求的可选依赖项的消息。

查看以下 yarn GitHub 个问题:

不确定 yarn check 但 installing/updating:yarn --silent 甚至更好 yarn --silent --ignore-optional

yarn --silent 安装可选的 deps,但没有输出。

注意:如果 运行 --ignore-optional 标志你可能在没有意识到的情况下依赖了一些可选的依赖项。因此,我建议在测试项目之前删除 node_modules 文件夹和 yarn.lock 文件,然后删除 运行 yarn --ignore-optional。如果事实证明有您需要的可选 deps,则将它们添加为 [dev] deps [相应地]。 尽管如果它只是 fsevents 并且从未安装过,请不要担心。