ember-try
ember-try copied to clipboard
Yarn Berry (v2 & v3) is not supported: Unsupported option name ("--no-lockfile")
Hi!
When trying to run yarn test:ember-compatibility
in my addon, I receive:
❯ yarn test:ember-compatibility
Unknown Syntax Error: Unsupported option name ("--no-lockfile").
$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
Error!
1
undefined
This is because Yarn Berry does not have the --no-lockfile
option.
I cannot use Yarn 1 because it crashes on nohoist: *
, and package hoisting in my monorepo breaks many things.
You can customize the options passed to yarn with the buildManagerOptions()
function in the config https://github.com/ember-cli/ember-try/blob/master/README.md#config
However, I think it is worth noting that ember-cli
also does not support yarn > 1 https://github.com/ember-cli/ember-cli/issues/8164
@kategengler can we revisit this now that ember-cli does in fact support yarn berry? The issue you linked has been closed as the blocking problems were resolved in the last few years.
I'd be happy to look at a PR, but, in general, yarn support in ember-cli and associated addons is somewhat stale. I opened this issue myself https://github.com/ember-cli/ember-cli/issues/10339 but have since moved to pnpm.
I can confirm that yarn berry works generally for ember apps - we've been using it in production for several years now. The main gap is that ember-try forces the non-existent --no-lockfile
flag when useYarn
is true, and as of Yarn 4+, that actually throws an error which crashes the tests. In Yarn 3, it fails silently instead (but likely still isn't doing the behavior ember-try wants).
As such, I'm less worried about overall yarn support in ember-cli and more about making sure that ember-try isn't actively causing failures while the rest of the ecosystem seems to be working fine.
I'm happy to look at a PR to support, but until then, the buildManagerOptions
above is a decent workaround.