Skip to content

Instantly share code, notes, and snippets.

@kenmori
Last active May 20, 2024 09:20
Show Gist options
  • Save kenmori/2b31d0cde603751cf92afe2e2bb20263 to your computer and use it in GitHub Desktop.
Save kenmori/2b31d0cde603751cf92afe2e2bb20263 to your computer and use it in GitHub Desktop.
error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`

error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.

if you update your package.json only. and then run yarn install --frozen-lockfile

The above error show you on console.

it's say that you need to run just yarn install.

--fronzen-lockfile option is tell you need to update your lock.file which will be much dependency of package in your package.json.

It's possible to occure in server when you deploy. if there are your changed package.json that pushing to git repogitory already in server , But you forget to change yarn.lockfile and have not been git it, run above command (--forzen-lockfile). you notice that your forgot it.

@m3hari
Copy link

m3hari commented Dec 1, 2020

Thanks!

@hcooch2ch3
Copy link

thanks!

@VitorTS
Copy link

VitorTS commented Aug 12, 2021

どうも!

@vtereshyn
Copy link

frozen, fronzen or forzen? a lot of typo in such small text

@nik-neg
Copy link

nik-neg commented Sep 1, 2021

In my case the issue was resolved with the following:

I removed the yarn.lock file and continued to work with npm.
Because they use a default "yarn install --frozen-lockfile" command if both files package.json and yarn.lock are present in the folder
as described in the links below.

https://changelog.travis-ci.com/detect-use-of-yarn-lock-file-with-node-js-138600

https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#using-yarn

@turbodog03
Copy link

thank you!It helped me a lot. I use yarn adding the packages that npm installed before, and now it works well.

@brianpooe
Copy link

Thanks.

@El-Buen-Alex
Copy link

Gracias!

@AlvaroBarroso
Copy link

Try:
export NODE_OPTIONS=--openssl-legacy-provider

@vladpavlovski
Copy link

Thank you!

@Gonzalo-Bruna
Copy link

thank you it helped me a lot!

@jeffkershner
Copy link

Thank you!

@ajoslin103
Copy link

in order to get my project going again I had to use yarn 1

I installed corepack (suggested from the [deprecated] yarn version manager)

made sure I had entries in my package.json (and deleted a .yarnrc file asking for yarn 3)

  "packageManager": "yarn@1.22.19",
  "engines": {
    "node": ">=14.19 <=16.x",
    "yarn": "=1.22.19"
  },

Then activated the yarn I wanted

corepack prepare yarn@1.22.19 --activate

and then everything worked again

@keshu6598
Copy link

I also got this error in my build pipeline, just removing the ^ from dependency helped to solve the issue.

@irvingvjuarez
Copy link

I had a problem deploying a backend app in railway and I solved doing two things:

  • Removing the ^ from the dependencies
  • Deleting the yarn.lock file, since it was generated on the build process and therefore, this error didn't appeared anymore

@MakStashkevich
Copy link

Thanks!

@flashjames
Copy link

I had a problem deploying a backend app in railway and I solved doing two things:

* Removing the ^ from the dependencies

* Deleting the yarn.lock file, since it was generated on the build process and therefore, this error didn't appeared anymore

Thank you!

@nathantew14
Copy link

I had a problem deploying a backend app in railway and I solved doing two things:

  • Removing the ^ from the dependencies
  • Deleting the yarn.lock file, since it was generated on the build process and therefore, this error didn't appeared anymore

@irvingvjuarez can I ask where you deleted the yarn.lock file from?

@milanmajchrak
Copy link

Thanks!

@chris-activewrite
Copy link

@nik-neg you said:

if both files package.json and yarn.lock are present

I think you meant if both files package-lock.json and yarn.lock are present, right?

@benardelia
Copy link

this solve my issue thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment