CircleCI-Public / node-orb

An orb for working with Node.js on CircleCI
https://circleci.com/orbs/registry/orb/circleci/node
MIT License
52 stars 80 forks source link

fix: yarn install fails when release is tagged in GitHub but not yet published on yarnpkg.com #141

Closed eszjay closed 2 years ago

eszjay commented 2 years ago

We should check the latest version at the same source we will download from. In this solution, we use the package.json published on https://yarnpkg.com/package/yarn to resolve the latest version.

At the time of the problem, version 1.22.18 was tagged as a release on GitHub but 1.22.17 was the latest version on yarnpkg.com. The error was:

Latest version of Yarn is 1.22.18
Checking if YARN is already installed...
A different version of Yarn is installed (1.22.17); removing it
Installing YARN v1.22.18

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
mv: cannot stat ‘yarn-v1.22.18/*’: No such file or directory

Exited with code exit status 1

CircleCI received exit code 1
eszjay commented 2 years ago

It is rebased, but it looks like the tests did not run. Do they run on branches from forks?

KyleTryon commented 2 years ago

It is rebased, but it looks like the tests did not run. Do they run on branches from forks?

Totally expected 🙇 thank you. We disable building PRs for security reasons and spam. I can trigger the build on my end though by pulling it into a new branch to trigger the same commit.

Starting the tests now but they should be the same so we expect this will go fine.

orb-publisher commented 2 years ago

Your development orb has been published. It will expire in 30 days. You can preview what this will look like on the CircleCI Orb Registry at the following link: https://circleci.com/developer/orbs/orb/circleci/node?version=dev:bcf4fc779c1a3b976459ed17147f5ee96fef6210

KyleTryon commented 2 years ago

Ok It took me a moment but I wanted to make sure we have a solid link between yarn and this CDN and it does appear approved in the link you provided, I just wanted to picture that here:

image

When Iw as searching I did discover this though. It does not need to be addressed in this PR but good to know going forward.

The preferred way to manage Yarn is through Corepack, a new binary shipped with all Node.js releases starting from 16.10. It acts as an intermediary between you and Yarn, and lets you use different package manager versions across multiple projects without having to check-in the Yarn binary anymore.