berry
berry copied to clipboard
[Bug]: unable to initialize project with specific version
Self-service
- [ ] I'd be willing to implement a fix
Describe the bug
According to the documentation, one can set a specific Yarn version for a project via yarn set version <semver>
.
However, that does not work at all for a new project or any project that does not have a Yarn version higher than "classic" (2.x, 3.x, ...) actually installed.
So either the documentation is misleading (newcomers will not understand why a version should not work and are very likely to just ditch Yarn altogether).
To reproduce
Using the documented examples in a docker run
loop for initial project initialization:
for yarn_version in latest canary classic 3.x 2.0.0-rc.30 1.22.1 https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js; do printf 'Version "%s" ... ' "${yarn_version}"; docker run --rm --entrypoint '' node:16 yarn set version "${yarn_version}" >/dev/null 2>&1; if [ $? -gt 0 ]; then echo "FAIL"; else echo "OK"; fi; done
Yields:
Version "latest" ... OK
Version "canary" ... OK
Version "classic" ... OK
Version "3.x" ... FAIL
Version "2.0.0-rc.30" ... FAIL
Version "1.22.1" ... OK
Version "https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js" ... FAIL
Environment
irrelevant (see steps to reproduce)
Additional context
In all failure cases, the error message is:
An unexpected error occurred: "Release not found: ...".
The following workaround helps (executing yarn set version berry
before - please note the undocumented version):
for yarn_version in latest canary classic 3.x 2.0.0-rc.30 1.22.1 https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js; do printf 'Version "%s" ... ' "${yarn_version}"; docker run --rm --entrypoint '' node:16 sh -c "yarn set version berry && yarn set version ${yarn_version}" >/dev/null 2>&1; if [ $? -gt 0 ]; then echo "FAIL"; else echo "OK"; fi; done
Output:
Version "latest" ... OK
Version "canary" ... OK
Version "classic" ... OK
Version "3.x" ... OK
Version "2.0.0-rc.30" ... OK
Version "1.22.1" ... OK
Version "https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js" ... OK
The above workaround does not work using latest
:
Version "latest" ... OK
Version "canary" ... OK
Version "classic" ... OK
Version "3.x" ... FAIL
Version "2.0.0-rc.30" ... FAIL
Version "1.22.1" ... OK
Version "https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js" ... FAIL
Hi! 👋
This issue looks stale, and doesn't feature the reproducible
label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).
Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃
If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded
label. Thanks for helping us triaging our repository! 🌟
I am not an expert on sherlock and the docs are not helpful for cases like this. Also it looks like yarn sherlock
only creates child processes within the existing environment (which is already set up with yarn).
I don't see an option to supply a Docker image for an actual clean start.
The documentation you're referencing is for modern versions of Yarn, classic versions of Yarn wont necessarily support the same patterns that modern does.
@arcanis updated classic in https://github.com/yarnpkg/yarn/commit/63cf0ac1190b3490ce2a64fd07e6210fe4bf234b to support most of the v2 patterns so I'll let him decide if we should add the rest as well.