Why is my Node.js build failing because of conflicting lock files?
This issue commonly occurs when your application uses npm or yarn, and someone uses the other tool to install a package and checks the resulting lock file into the repo. It could create subtle, difficult-to-debug issues in production if different versions of dependencies are installed, so it's better to resolve this up front.
To resolve this, remove the lock file from the tool that your team does not usually use and redeploy your application:
If you use npm:
git rm yarn.lock git commit -m "Remove yarn lock file" git push heroku master
If you use yarn:
git rm package-lock.json git commit -m "Remove npm lock file" git push heroku master
If you need both lock files in your repo for some reason, we recommend adding the one you don't wish to use on Heroku to your .slugignore file https://devcenter.heroku.com/articles/slug-compiler#ignoring-files-with-slugignore