Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JoerJoers's avatar

YARN - How to generate yarn.lock

How do i generate the yarn.lock file for my existing project?

0 likes
5 replies
joedawson's avatar
Level 18

The yarn.lock file is automatically generated/updated when you install package(s). To my knowledge anyway.

willvincent's avatar

Exactly right.. just run yarn install (or even just yarn as it will default to install..) and it'll create the lockfile if it doesn't already exist.

1 like
patlecat's avatar

It did the first time I ran it. Then I deleted the lock file and from then on yarn kept complaining about the missing file but did not generate it again.

Cronix's avatar

delete the node_modules dir and run yarn install again. Commit the yarn.lock to your repo, and don't delete it again :)

Please or to participate in this conversation.