Skip to content
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 attempts to rebuild fsevents even on incompatible operating systems #2051

Closed
Daniel15 opened this issue Nov 28, 2016 · 36 comments
Closed
Assignees
Labels

Comments

@Daniel15
Copy link
Member

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
fsevents is only relevant on Mac OS, it does not compile on Linux or Windows. Yarn appears to try and compile it even on incompatible operating system. This is a waste of time as it's always going to fail.

If the current behavior is a bug, please provide the steps to reproduce.
This is the package.json from one of my sites:

{
  "name": "sitename",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "devDependencies": {
    "assets-webpack-plugin": "~3.0.0",
    "babel-core": "~5.8.25",
    "babel-loader": "~5.3.2",
    "exports-loader": "~0.6.2",
    "expose-loader": "~0.7.0",
    "imports-loader": "~0.6.4",
    "webpack": "~1.12.2"
  },
  "repository": {
    "type": "git",
    "url": "daniel@host.dan.cx:/var/local/git/sitename"
  },
  "author": "Daniel Lo Nigro <daniel@dan.cx> (http://dan.cx/)",
  "scripts": {
    "build-dev": "NODE_ENV=development webpack -d",
    "build-prod": "NODE_ENV=production webpack -p",
    "watch": "NODE_ENV=development webpack --progress --colors --watch -d",
    "update-babel-helpers": "babel-external-helpers -l get,inherits,create-class,class-call-check,extends,interop-require-default > ./public/assets/js/babel-external-helpers.js"
  },
  "dependencies": {
    "array.prototype.find": "~1.0.0",
    "babel-runtime": "~5.8.25",
    "classnames": "^2.1.5",
    "fbemitter": "^2.0.0",
    "flux": "~2.1.1",
    "react": "~0.14.0",
    "react-onclickoutside": "git://github.com/Daniel15/react-onclickoutside.git"
  }
}

Running yarn gives me this as part of the output:

[2/4] Fetching packages...
warning fsevents@1.0.15: The platform "win32" is incompatible with this module.
info "fsevents@1.0.15" is an optional dependency and failed compatibility check. Excluding it from installation.

However, in the "Building fresh packages..." stage of installation, it still attempts to build the dependency, which obviously fails as it should only be built on Mac OS.

The installation still succeeds so this is not a blocker, it's just very odd behaviour.

The second time I run yarn, it shows that everything is up-to-date:

yarn install v0.17.8
warning sitename@0.0.0: No license field
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.28s.

However, when I add another dependency, it tries to build fsevents again.

What is the expected behavior?
Yarn should not attempt to build a native dependency if it's incompatible with the current OS

npm handles this correctly:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.15

Please mention your node.js, yarn and operating system version.
Yarn 0.17.8
Windows 10
Node.js 6.9.1

@nsgundy
Copy link

nsgundy commented Nov 28, 2016

Having the same issue... makes the output look like there was an issue when running 'yarn install' and eats some extra seconds.

@schue30
Copy link

schue30 commented Nov 29, 2016

this problem should be solved with #1997

@Daniel15
Copy link
Member Author

Yes, confirmed fixed in latest nightly build:

yarn install v0.18.0-20161129.2058
info No lockfile found.
warning sitename@0.0.0: No license field
[1/4] Resolving packages...
warning babel-core > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
warning fsevents@1.0.15: The platform "win32" is incompatible with this module.
info "fsevents@1.0.15" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.

@bevacqua
Copy link

bevacqua commented Dec 5, 2016

Doesn't seem to be fixed for linux. npm run yarn just runs yarn. The build is stuck forever after this warning.

Successfully built 926b219559f2
+ docker run --rm -v /var/jenkins_home/workspace/cloud-ui@2/cloud-ui:/src adminconsole-node:latest /bin/sh -c '
    set -ex;

    npm prune;

    npm install yarn >/dev/null;
    npm run yarn > /dev/null;

    npm run verify-deps;
    npm run lint;
    CI=true npm test;
  '
+ npm prune
+ npm install yarn
npm WARN prefer global yarn@0.18.0 should be installed with -g
+ npm run yarn
warning fsevents@1.0.15: The platform "linux" is incompatible with this module.

@PowrSlave
Copy link

I am getting this error on a windows 7 machine and IT IS blocking me since I can't get any packages to install when it hits.

@mattbishop
Copy link

Still seeing this issue with yarn 1.9.4 on Azure DevOps (formerly VSTS)

@net
Copy link

net commented Oct 1, 2018

Same issue on 1.9.4 with:

"resolutions": {
  "**/fsevents": ">=1.2.4"
}

@madroneropaulo
Copy link

It seems that this issue is back.

@joeytwiddle
Copy link

joeytwiddle commented Oct 18, 2018

Possibly related: I am on macOS, and fsevents is rebuilding every time I run yarn, even if the correct version is already installed.

I don't think that used to happen. I think yarn used to finish immediately with the message "success Already up-to-date."

Of the 11 dependencies that need to be built on a fresh install, fsevents is the only dependency which rebuilds on every install.

Update: I am happy to report that, after upgrading from 1.10.1 to 1.12.1, this problem has stopped. We have got the "Already up-to-date" message back, and short install times. Thank you!

My environment: yarn version 1.10.1

My package.json: (I tried but failed to narrow down the minimal deps needed to trigger this problem)

{
  "dependencies": {
    "@loopback/authentication": "^0.8.0",
    "@loopback/boot": "^0.8.0",
    "@loopback/context": "^0.8.0",
    "@loopback/core": "^0.6.0",
    "@loopback/openapi-v3": "^0.7.0",
    "@loopback/repository": "^0.8.0",
    "@loopback/repository-json-schema": "^0.6.0",
    "@loopback/rest": "^0.7.0",
    "@types/bitcoinjs-lib": "^3.4.0",
    "@types/ramda": "^0.25.32",
    "@types/socket.io": "^1.4.33",
    "@types/speakeasy": "^2.0.2",
    "@types/underscore": "^1.8.8",
    "bcrypt": "^2.0.0",
    "bignumber.js": "^7.2.1",
    "bitcoin-core": "^2.0.0",
    "bitcoind-rpc": "^0.7.1",
    "bitcoinjs-lib": "^3.3.2",
    "colors": "^1.3.1",
    "crypto": "^1.0.1",
    "crypto-js": "^3.1.9-1",
    "cryptocompare": "^0.5.0",
    "ethereumjs-tx": "^1.3.4",
    "forever": "^0.15.3",
    "geoip-lite": "^1.3.2",
    "i18n": "^0.8.3",
    "i18next": "^11.8.0",
    "loopback": "^3.19.0",
    "loopback-connector-mongodb": "^3.4.3",
    "memoizee": "^0.4.12",
    "nodemailer": "^4.6.8",
    "nodemailer-html-to-text": "^3.0.0",
    "nodemon": "^1.17.3",
    "passport-http": "^0.3.0",
    "ramda": "^0.25.0",
    "socket.io": "^2.1.0",
    "socket.io-fix-close": "^0.0.2",
    "socketio-auth": "^0.1.0",
    "speakeasy": "^2.0.0",
    "web3": "^1.0.0-beta.34",
    "web3-eth-personal": "^1.0.0-beta.34"
  },
  "devDependencies": {
    "@loopback/build": "^0.5.0",
    "@loopback/testlab": "^0.7.0",
    "@types/mocha": "^5.0.0",
    "@types/node": "^8.10.0",
    "@types/passport": "^0.4.5",
    "@types/passport-http": "^0.3.6",
    "@types/socket.io-client": "^1.4.32",
    "mocha": "^5.0.4",
    "socket.io-client": "^2.1.0",
    "source-map-support": "^0.5.4"
  }
}

@inversion
Copy link

Getting this issue with 1.10.1 too on linux

@joeytwiddle
Copy link

People getting this problem, you might try upgrading from 1.10.1 to 1.12.1. That has fixed it for us.

@adamreisnz
Copy link

adamreisnz commented Dec 30, 2018

Getting this issue with 1.12.3, the install aborts with an error:

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

Used to be a warning and the module used to be ignored.

This is with running yarn --pure-lockfile --production or yarn

@Daniel15
Copy link
Member Author

Daniel15 commented Dec 30, 2018 via email

@adamreisnz
Copy link

adamreisnz commented Dec 30, 2018

It is a nested optional dependency, but I discovered that the problem was due to the following added lines in package.json:

"resolutions": {
    "nodemon/chokidar/fsevents": "1.2.4"
  }

This was needed to make it work with Node 10, but apparently manually adding the resolution forces yarn to try and install the package, even if it's an optional dependency.

@snewcomer
Copy link

Also saw this error. Updating node from 6 to 8 fixed it for us.

https://travis-ci.org/ember-infinity/ember-infinity/jobs/478166551

@adamreisnz
Copy link

adamreisnz commented Feb 5, 2019

I also encountered this again, we had fsevents in resolutions because of some prior issue, but that wasn't necessary anymore. However, I still think yarn shouldn't fail on an optional package, even if it's specified in the resolutions. Those resolutions should only be used if the package is actually installed (which it shouldn't on linux).

@nbaua
Copy link

nbaua commented Feb 24, 2019

Yarn still got this

PROMPT>yarn global add @nestjs/cli
yarn global v1.13.0

[1/4] Resolving packages...

[2/4] Fetching packages...

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

[3/4] Linking dependencies...

I had to use npm force install for this.

@iemwill
Copy link

iemwill commented May 8, 2019

But did it worked afterwards? In my case not.

@jcollum-nike
Copy link

jcollum-nike commented Jun 6, 2019

Still seeing it in 1.15.2, this is in a fresh node:8 container

yarn --network-timeout 100000 install  
yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...

@jacorachan
Copy link

Windows 10 Build 16299 system output:

λ yarn install
yarn install v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 61.98s.

My package.json:

{
    "name": "Test",
    "version": "0.1.0",
    "private": true,
    "scripts": {
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "lint": "vue-cli-service lint"
    },
    "dependencies": {
        "core-js": "^2.6.5",
        "vue": "^2.6.10",
        "vue-router": "^3.0.6"
    },
    "devDependencies": {
        "@vue/cli-plugin-babel": "^3.7.0",
        "@vue/cli-plugin-eslint": "^3.7.0",
        "@vue/cli-service": "^3.7.0",
        "@vue/eslint-config-standard": "^4.0.0",
        "babel-eslint": "^10.0.1",
        "eslint": "^5.16.0",
        "eslint-plugin-vue": "^5.0.0",
        "tailwindcss": "1.1",
        "vue-template-compiler": "^2.6.10"
    }
}

@ryantando
Copy link

Try this

yarn config set ignore-engines true

@KiruthikaMKS1617
Copy link

Try this

yarn config set ignore-engines true

Thanks, this worked in my case too.

@pgnd
Copy link

pgnd commented Nov 8, 2019

@ryantando

Try this
yarn config set ignore-engines true

Should that^^ stop the incessant, every-time-yarn-execs noise,

...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.1: The platform "linux" is incompatible with this module.
info "fsevents@2.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
...

as well?

If not, any hints as to what can/does?

@syedzubairahmed001
Copy link

I am still facing this issue with v1.22.4

yarn add notistack yarn add v1.22.4 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.1.2: The platform "win32" is incompatible with this module. info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.12: The platform "win32" is incompatible with this module. info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning " > react-ga@2.7.0" has unmet peer dependency "prop-types@^15.6.0". warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".

@adisher
Copy link

adisher commented Jun 2, 2020

I believe it somehow effects my surge deployment process. I'm creating a workflow in github actions but it fails.

yarn remove v1.22.4
[1/2] Removing module cra-template...
[2/2] Regenerating lockfile and installing missing dependencies...
info fsevents@2.1.2: The platform "win32" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.12: The platform "win32" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
success Uninstalled packages.

@Daniel15
Copy link
Member Author

@adisher It's just a warning and shouldn't actually break anything.

@papadi
Copy link

papadi commented Jul 9, 2020

Try this

yarn config set ignore-engines true

What are the side effects of this call?

zenglenn42 added a commit to zenglenn42/react-tutorials that referenced this issue Jul 20, 2020
heh, it looks like fsevents 2.1.3 has some macOS-specific code in it.
which cannot be built on the linux deployment target.  fair enough

% yarn run build

    yarns calls this out at build time on heroku, complaining the module
    is not compatible with 'linux' platform

Issue is discussed here:

    yarnpkg/yarn#2051

for now, i'll just relax on my resolution of 1.x --to--> 2.x upgrade
at the expense of seeing the following warning at yarn install time:

% yarn install

    warning react-scripts > webpack-dev-server > chokidar > fsevents@1.2.13:
    fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
@ianchanning
Copy link

@papadi Well, this is the yarn documentation for yarn install --ignore-engines:

Do not execute any scripts defined in the project package.json and its dependencies.

So I assume that somewhere in the install chain there is some script that tries to install fsevents. But turning this off for ever seems a bit more than required. You could just try running yarn install --ignore-engines for this case.

@CeruttiMaicon
Copy link

I need to switch to a specific node version and it worked. :)

@smcelhinney
Copy link

I need to switch to a specific node version and it worked. :)

And what version of node was that?

@thinnakrit
Copy link

Try this

yarn config set ignore-engines true

It's work !!!

@ferenczy
Copy link

ferenczy commented May 6, 2021

I have executed the yarn command in the GitHub Desktop app's repository and got the following "info" severity messages:

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

I'm not sure what exactly is the "optional dependency" and what consequences the fact that it's not being installed may have. Should I just ignore it? I have tried to use the option --ignore-engines with both yarn and yarn install but those messages are still being produced. I'm not sure I want to set it globally in the config as I don't know what consequences it may have (e.g. what potential errors I may miss).

@nbaua
Copy link

nbaua commented May 7, 2021

@ferenczy ,
FS Events is kinda pain in ***, if you are facing issues in your project creation or build at any point of time, consider using npm install --no-optional flag while installing your package(s) which are producing this error. If you're not facing any issues but freaked out (like me, few months back), you have 2 options,

Option A) - Simply ignore as it is optional dependency(most of the time)

OR

Option B) - Switch to other supported OS, if you are comfortable working in non-windows OS enviornment.

@locofocos
Copy link

locofocos commented Feb 16, 2024

For some reason, yarn config set ignore-engines true and yarn install --ignore-engines aren't bypassing the resolutions / optional dependency issue, at least in our Github CI build with actions/setup-node@v2.

It is a nested optional dependency, but I discovered that the problem was due to the following added lines in package.json:

"resolutions": {
    "nodemon/chokidar/fsevents": "1.2.4"
  }

This was needed to make it work with Node 10, but apparently manually adding the resolution forces yarn to try and install the package, even if it's an optional dependency.

This is fixed in yarn v2 #7590 🎉

For those of who are still using yarn v1..... instead of pinning fsevents directly in resolutions, you can pin a newer version of whatever dependency is pulling in fsevents. In our case, chokidar was listing fsevents as an optional dependency. So I found the newer version of chokidar that began consuming the fsevents version I need, then I set this version in package.json:

  "resolutions": {
...
    "chokidar": "^3.5.0"
  },

@nbaua
Copy link

nbaua commented Feb 17, 2024

After 1000+ days, the saga still continues..
Sometimes developers get so much caught in the dependency drains.
@locofocos . Thanks for posting this.

@nbaua
Copy link

nbaua commented Feb 17, 2024

BTW, as far as I recall,
When I switched to PNPM, I never got this issue.

@locofocos
Can you please check that option as well ! If you have provision for checking the alternative package manager.
That would be a great help. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests