I was trying to merge my pull request to a repository. I got this error:
error Your lockfile needs to be updated, but yarn was run with --frozen-lockfile.
I figured this was due to my changes including new packages, so the lockfile has to be updated. So I pushed my modified lockfile and updated the pull request, then fixed the merge conflict on the lockfile on GitHub and committed the changes. However, the new commit still throws the exact same error. What am I doing wrong?
My ci-test.yaml
file:
name: ci-test
on:
pull_request:
push:
branches:
- main
- dev
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2-beta
with:
node-version: '16'
- name: Install dependencies
run: cd backend; yarn install --frozen-lockfile;
- name: Run tests
run: cd backend; yarn test:e2e --force-exit;
I tried cloning a fresh copy of my forked repo, checked out the branch I was working on, then did cd backend
then yarn install —-frozen-lockfile
as specified by the ci-test.yaml
file… and it worked perfectly fine. So why won’t it work on Github Actions???
It turns out that the GitHub Action VM was using Yarn 1.22.19 while I was developing locally with Yarn 3x, which made the lockfile different so it had to be modified when installing dependencies on Github Actions. I ended up changing to Yarn 1x locally instead.