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

MohamedTammam's avatar

package-lock.json conflict on prod server

I like to build on the my assets on the server so my repo doesn't need to track all unnecessary changes. However because I build on the server the package-lock.json file gets changed, therefor I need to git reset that file after deployment.

Any ideas how to stop that? should I add that file to .gitignore, will that cause an issue?

0 likes
3 replies
Sinnbeck's avatar

Are you running npm update instead of npm install? It should not change on either install or build should change the lock file

MohamedTammam's avatar

@Sinnbeck Just npm install, I work on windows and the server is Linux. I believe that's the issue.

Because when I work with other developer that uses Linux, the package-lock.json also changes during the development when running npm install

Sinnbeck's avatar

@MohamedTammam could be. Personally I reset my production to ensure it merges

Run this before merging on production to ensure that it's clean

git reset --hard 
1 like

Please or to participate in this conversation.