'fsevent causes yarn install to fail on Windows and Linux [yarn berry]

I have initiated a Strapi project on Mac (OSX). The project has peer dependency of chokidar which comes with an optional dependency fsevents

the package.json of chokidar in node_modules :

  "dependencies": {
    "anymatch": "~3.1.2",
    ...
  },
  "optionalDependencies": {
    "fsevents": "~2.3.2"
  },

I am using yarn berry for package managing. Now the project installs packages and runs correctly on Mac machines but on windows/Linux machines the yarn install fails at link step

Shouldn't it skip the build/link of the optional dependencies?

how can I solve the issue so the project can be cloned and run on all Operating systems?

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source