30

I want to deploy my website to Heroku but I get the next error:

error fsevents@2.0.7: The platform "linux" is incompatible with this module.
error Found incompatible module.

I've already tried upgrading yarn, node but it didn't help. I use macOS Mojave v 10.14.5 and I cannot understand why is linux here.



remote: -----> Installing binaries
remote:        engines.node (package.json):  10.15.3
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  unspecified (use default)
remote:        
remote:        Resolving node version 10.15.3...
remote:        Downloading and installing node 10.15.3...
remote:        Using default npm version: 6.4.1
remote:        Resolving yarn version 1.x...
remote:        Downloading and installing yarn (1.17.3)...
remote:        Installed yarn 1.17.3
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.17.3
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
error fsevents@2.0.7: The platform "linux" is incompatible with this module.
remote:        error Found incompatible module.

tk421
  • 5,775
  • 6
  • 23
  • 34
Ilya Solodeev
  • 367
  • 2
  • 4
  • 12
  • i'm stuck in this same issue over a month and i give up, i literally tried everything possible and googled all the internet for a solution, nothing solves this. so i changed to yarn – Joe RR Oct 06 '20 at 03:34
  • see yarn issue [fsevents@1.1.2: The platform "win32" is incompatible with this module](https://github.com/yarnpkg/yarn/issues/3726) – milahu Oct 11 '22 at 19:14

3 Answers3

15

yarn --ignore-platform This will fix the issue. As the name suggests it'll ignore the platform(Mac/Linux) and install those dependencies.

Sougata Das
  • 169
  • 1
  • 3
  • 5
    Your answer could be improved by adding more information on what the code does and how it helps the OP. – Tyler2P Nov 27 '21 at 11:51
  • 1
    I'm pretty sure it should be used like so `yarn install --ignore-engines` (found the example [here](https://stackoverflow.com/a/45088032/5783745)) – stevec Feb 19 '23 at 14:55
  • @stevec `yarn` command works same as `yarn install` command. So `yarn --ignore-platform` is same as `yarn install --ignore-engines` – Sougata Das Jul 22 '23 at 20:43
11

I removed lines

fsevents@^1.2.7, fsevents@^2.0.6:
  version "2.0.7"
  resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a"
  integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ==

and

  optionalDependencies:
    fsevents "^2.0.6"

from yarn.lock. Next I removed

    "fsevents": "2.0.7",

from resolutions key in package.json

Finally on yarn install I can see

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

and

success Saved lockfile.

You do not need this module because of this is only for MacOS

Native access to MacOS FSEvents in Node.js

https://www.npmjs.com/package/fsevents

Daniel
  • 7,684
  • 7
  • 52
  • 76
3

I'm getting the error now, but Heroku excludes fsevents and results in a successful deploy.

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

https://my-app.herokuapp.com/ deployed to Heroku.

I didn't modify yarn.lock or any other files. I ended up at the post because I was curious about the error and now I know it's for macOS only. In other words ignore the error and leave yarn.lock alone.

Greg
  • 2,359
  • 5
  • 22
  • 35
  • Just a heads up that this advice this may work for heroku, but probably won't for other services. It is still a fatal error in many situations and removing it or somehow making it conditional for macos or local development only (perhaps turning it into a devDependency, which you use locally, and when you build elsewhere on linux, you'd use a $NODE_ENV of production?) is still the correct fix, in my not so humble opinion :) – fool Apr 17 '21 at 22:22
  • That's odd, I experience the opposite: no problems locally (macOS), but have the problem on heroku. – stevec Feb 19 '23 at 13:22