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

Chris1904's avatar

yarn.lock causing auto deploy error

Hi everyone,

I am wondering about best practices and how you deal with this scenario:

Currently, my deployment script is:

cd /home/forge/dev.url.io
git pull origin master
yarn install
yarn build
echo "" | sudo -S service php7.2-fpm reload

which results in constant:

error: Your local changes to the following files would be overwritten by merge: yarn.lock.

How would you deal with this "issue"?

git stash save --keep-index ?

Thanks!

Chris

0 likes
3 replies
bobbybouwmann's avatar

Yeah, so everytime you run yarn build it will generate a new yarn.lock file. Ideally you don't want that in your project. Instead you just want to run yarn to install based on the current yarn.lock file so your local and production environment install the same packages!

What is the yarn build command doing for you? It's not a standard command for yarn!

1 like
ejdelmonico's avatar

If your question is referring to a Vue SPA frontend, then you need to cd into whichever directory your frontend is in and then run the build command. Yarn will then use the lock file in your SPA portion of the site.

1 like
Chris1904's avatar

I was referring to a Vue SPA - yarn build creates the production build in a Vue CLI project.

So if I understand correctly, I do not need yarn or yarn install in my deploy script, because yarn build installs the dependencies from the lock file?

Thanks for the assistance!

Please or to participate in this conversation.