yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.43k stars 2.72k forks source link

Yarn attempts to rebuild fsevents even on incompatible operating systems #2051

Closed Daniel15 closed 7 years ago

Daniel15 commented 7 years ago

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 commented 7 years ago

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

schue30 commented 7 years ago

this problem should be solved with https://github.com/yarnpkg/yarn/pull/1997

Daniel15 commented 7 years ago

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 commented 7 years ago

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 commented 6 years ago

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 commented 6 years ago

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

net commented 6 years ago

Same issue on 1.9.4 with:

"resolutions": {
  "**/fsevents": ">=1.2.4"
}
madroneropaulo commented 6 years ago

It seems that this issue is back.

joeytwiddle commented 6 years ago

~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 commented 5 years ago

Getting this issue with 1.10.1 too on linux

joeytwiddle commented 5 years ago

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

adamreisnz commented 5 years ago

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 commented 5 years ago

Are you sure fsevents is listed as an optional dependency? If it's not optional, it'll fail on Linux, which is expected.

Sent from my phone.

On Sun, Dec 30, 2018, 3:12 PM Adam Reis <notifications@github.com wrote:

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.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/yarnpkg/yarn/issues/2051#issuecomment-450593265, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFnHb-blfOUg-LYdjrhDhh2wdpL6DTQks5u-UhygaJpZM4K9Tb7 .

adamreisnz commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

But did it worked afterwards? In my case not.

jcollum-nike commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Try this

yarn config set ignore-engines true

KiruthikaMKS1617 commented 5 years ago

Try this

yarn config set ignore-engines true

Thanks, this worked in my case too.

pgnd commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

papadi commented 4 years ago

Try this

yarn config set ignore-engines true

What are the side effects of this call?

ianchanning commented 4 years ago

@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 commented 4 years ago

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

smcelhinney commented 4 years ago

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

And what version of node was that?

thinnakrit commented 3 years ago

Try this

yarn config set ignore-engines true

It's work !!!

ferenczy commented 3 years ago

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 commented 3 years ago

@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 commented 8 months ago

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 https://github.com/yarnpkg/yarn/issues/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 commented 8 months ago

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

nbaua commented 8 months ago

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.