I was just trying to install electron-forge with yarn and it won't install, saying that "linux" platform is incompatible with the module macos-alias. npm installs correctly (doesn't even throws a warning about macos-alias).
yarn global add electron-forge --prefix ~/.npm-global
Throws (without the #, of course, just for highlight the error part):
# yarn global v0.20.3
# [1/4] Resolving packages...
# warning electron-forge > zip-folder > archiver > glob > [email protected]:
# Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
# warning electron-forge > electron-windows-store > flatten-packages >[email protected]:
# wrench.js is deprecated! You should check out
# fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations
# you were using wrench for. Thanks for all the usage over the years.
# warning electron-forge > electron-packager > asar > mksnapshot > request > [email protected]:
# use uuid module instead
# warning electron-forge > nugget > progress-stream > through2 > xtend >[email protected]:
# [2/4] Fetching packages...
# warning [email protected]: The platform "linux" is incompatible with this module.
# info "[email protected]" is an optional dependency and failed compatibility check. # Excluding it from installation.
error [email protected]: The platform "linux" is incompatible with this module.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
Is this a problem of electron-forge with yarn (like some configuration) or a yarn specific one?
@soulchainer This is a known issue with yarn and optional dependencies. See https://github.com/yarnpkg/yarn/issues/1435
@MarshallOfSound couldn't this be fixed by just changing electron-installer-dmg to be an optionalDependency? Is there a reason it needs to be non-optional?
@bendemboski I tried it, that doesn't fix the problem.
It's because at the moment yarn fails loudly if dependencies of optionalDependencies fail. This is a problem on their end of things
Yarn is an exceptionally poor fit for Electron apps, because any yarn.lock file you generate is going to be wrong for 2 out of 3 of your target operating systems
My company is standardized on MacOS as our dev machines, and it speeds up development quite a bit to have a yarn.lock file. We can easily tell the CI machines running other OS's to ignore the lock file, losing the benefits there, but still realizing them in our dev cycles.
I suspect that the statement "yarn is not a good choice for any project with optional dependencies" is not one that the yarn folks would want to just live with, no?
I would hope so, but that issue that @MarshallOfSound referenced has been open for several months. Perhaps they consider Electron apps to be an edge case?
Yeah, there's an old PR here that purported to fix the issue at some point. It was just closed a few hours ago, so I dropped a comment clarifying that it's definitely not fixed. Maybe some 馃憤 s or additional comments or something would help get it on somebody's radar?
If not, maybe I'll try opening a new PR that's up-to-date with master and has that fix, or this other proposed fix.
@bendemboski thanks for pushing forward on this. As someone who runs Linux as their primary dev environment, it's very much appreciated.
Okay, hopefully https://github.com/yarnpkg/yarn/pull/2811 or https://github.com/mongodb-js/electron-installer-dmg/pull/13 will land soon so this will stop being an issue! For the time being anybody that's hating life because of this could just check out and build my branch and run it locally (although it would be more of a pain to get it working in CI)
This issue has been fixed, I confirmed it, yarnpkg/yarn#1435 is finally squashed in the latest 0.23.0 nightly :)
馃帀 can anyone confirm what happens to yarn.lock? building for 3 platforms seems impossible if generating the lock on one platform.
@kevingelion I think @paulcbetts commented somewhere (don't remember where, sorry) that the problem you mention is a big blocker in version controlling yarn.lock for Electron apps.
Most helpful comment
@bendemboski thanks for pushing forward on this. As someone who runs Linux as their primary dev environment, it's very much appreciated.