How do I use Yarn 3.4.1 with the node orb?

We are trying to update to using the latest version of yarn, instead of “classic” or version 1, which is no longer active )GitHub - yarnpkg/yarn: The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry). I get an error if I try to specify that version in the node spec. The docs seem all about installing the packages outside of our scripts. I want that in our scripts.

Can you provide some more information as to what you’re experiencing? Like which Docs you’re reviewing, a copy of your config.yml file, error messages, etc? This will help in routing to a good answer.

Well, so first, I tried

   - node/install:
        install-yarn: true
        yarn-version: 3.4.1
        node-version: '16.19.0'

And I got

Selected version of Yarn is 3.4.1
Checking if YARN is already installed...
Installing YARN v3.4.1
^@^@
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
mv: cannot stat 'yarn-v3.4.1/*': No such file or directory

And subsequent searches of the docs indicated that that mechanism only worked with yarn 1.
Now I am doing a run block to install it:

    name: Yarn Set Version Stable                                                                                                                                   
    command: |                                                                                                                                                      
     npm install -g yarn || echo "Yarn may have already been installed."                                                                                            
     yarn set version stable                                                                                                                                        

but not sure if that is the best way.

1 Like

Thank you - I have pinged this to the team to see what’s up

Thanks for sharing @nroose. BAsed on the information you provided, it seems like we could possibly drop Yarn 1 in future major versions of the Node orb, does that seem acceptable to you?

For a workaround, what you are showing there is actually more or less exactly what we would change to the orb as well. I believe we originally were pulling from GitHub releases to ensure a version number, but that is subject to change and cause issues like you saw here, installing via NPM may be more reliable as it self-installs.

So, uh, we are actually struggling now with the upgrade. I am a little ahead of the team in figuring out how to do it on CircleCI. I think a lot of yarn users are still on the old one, unfortunately. And I think the benefits of yarn are no longer that much better than NPM anyway, so we may just go back to npm. In the end, I think supporting 1 and 3 would be great. I guess 2 didn’t last long, so not sure about that one.

Uh, did you change something? We are getting errors on the old version now.

Oh, now it’s working!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.