Default Yarn version is now 1.17

The default Yarn version for building sites is now 1.17. You can set a YARN_VERSION environment variable to use any specific version, otherwise the default version will be used.
You can learn more in the build environment variables docs.

5 Likes

Hi Keiko, welcome to the community! :rofl::rofl::rofl:

This is awesome news!

4 Likes

My build report shows yarn 1.3.2 was use (and I haven’t forced any version on it)

Why is this?

1 Like

Hi @PedroLamas! When you make the first deployment, we lock the yarn version with that site with the current default yarn version of Netlify. Any following deployments will use this locked version of yarn.
If you wish to use any different version (including 1.17), please specify it via YARN_VERSION in build environment variables.
If you deploy a new site now, it will be using 1.17!

3 Likes

Working fine after I set the version to “1.17.3” (got an error with just “1.17” though)

Thanks @keiko :slight_smile:

2 Likes

Oh didn’t know that it gives an error! Thanks for sharing, very helpful @PedroLamas!

3 Likes

This thread was very helpful! Thank you :slight_smile:

For me NODE_VERSION is allowed to only have MAJOR.MINOR and omit patch, but YARN_VERSION requires MAJOR.MINOR.PATCH. I had the same error as @PedroLamas when I only set YARN_VERSION to 1.21 and not 1.21.1.

When I matched versions for my build process, everything matched my local machine and built as expected :rocket:!

Hey, it seems the env variable also works for me.

Still wanted to share the error I get, that was due to having a custom yarn install inside a node module (funny, because it was brought in the app from netlify-cli :D)

yarn why yarn

What I did is to force the node module to use the version I want instead, so that netlify does not use that older version.

“resolutions”: {
“yarn”: “1.21.1”
},

I…think you’re saying you got everything working, if in a bit unexpected way? If so, yay!

If you’re attempting to report a build plugins or cli bug, could I please encourage you to file an issue on one or the other?

Yes it works.

It’s just if you use YARN_VERSION=1.21.1 and then you have a different yarn version (even transitive) in your dependencies, yarn seems to automatically pick the version of yur dependency (which may be different from the one you asked netlify to use). Afaik it’s on purpose and a yarn behavior, there’s nothing Netlify can do about it, just wanted to report this fact so that other people running into the same issue know how to solve it.

1 Like

thank you for explaining, @slorber!

I had a similar issue, with a package and not being compatible with the default version of yarn which was 1.13. The package needed yarn 1.16. So I had to set the Yarn variable like @keiko suggested as well as delete the yarn.lock file in my project directory. Then rebuild.

Thanks for the help Netlify!

1 Like