0

I keep getting the "Two different lockfiles found" error when trying to deploy to Heroku

remote: Building source:
remote:  !     Two different lockfiles found: package-lock.json and yarn.lock
remote:        Both npm and yarn have created lockfiles for this application,
remote:        but only one can be used to install dependencies. Installing
remote:        dependencies using the wrong package manager can result in missing
remote:        packages or subtle bugs in production.

I've found a few threads on here that have the same issue except... I don't have a yarn.lock file to remove.

If I run the commands suggested in this thread:Heroku build failing due to Yarn and npm lockfile conflict, I just get a message saying there isn't a file to remove. I'm checking the repo and my files in vsCode and i don't see a yarn.lock file so why does Heroku think I have a yarn.lock file?

SOLUTION: I found out that I had configured the heroku project to auto deploy based on my commits to the repo on Github. I guess the error message I was receiving wast he only one that applied when I was trying to manually push to heroku and i wasn't supposed to. If you run into this check you heroku settings, if you have auto deploy this situation may come up.

Officer_Narc
  • 195
  • 3
  • 15
  • Could you go to your project root directory and execute the command `ls -a`? Still no `yarn.lock` file? Are you sure the `yarn.lock` file is removed in the remote repository? – Wasbeer Jan 30 '20 at 19:31
  • I checked both with ls -a and theres still not yarn.lock. Not sure what else I can do – Officer_Narc Jan 30 '20 at 20:37
  • Have you tried running ls -a through the Heroku CLI? It's possible that your app instance on Heroku has a yarn.lock file. Example: "heroku run bash --app your-app-name". After bash mounts, try typing ls -a, and see if you have both package.lock and yarn.lock. – developthewebz Jan 30 '20 at 21:35
  • The error message was a but misleading, but i found out what my problem was. my deployment settings were set to automatic – Officer_Narc Jan 30 '20 at 22:15

1 Answers1

0

Just in case... when you type git push heroku master be sure you're master Branch doesn't have two lockfiles in it. If you are a on another Branch just try git push heroku <your branch name you want to push>