Cannot read property 'match' on undefined on pushing to heroku

I had this same issue, however none of the solutions mentioned above worked for me, I even tried to clean my remote repo, using heroku-repo plugin which by the way you can install using heroku plugins:install heroku-repo followed by heroku repo:reset -a appname to try luck with this one.

The solutions which worked for me was to disable the node_modules cache from heroku. Heroku maintains a cache directory that is persisted between builds. This cache is used to store caches for npm, yarn, and bower.

Try using the following steps.

  1. heroku config:set NODE_MODULES_CACHE=false
  2. now push again with - git push heroku master

This issue is most likely related to your package-lock.json. This file causes a lot of issues, but it's recommended that you check it into source.

With that said, one of two things should fix your issue:

  1. First try deleting your package-lock.json and node_modules locally, then re-install all of your dependencies: npm i. Try pushing to Heroku again after this is complete.
  2. If the suggestion above does not work, just delete your package-lock.json file locally, commit your change, and try pushing to Heroku again.

Also, you should not have to list react as a dev dependency. You can delete that from your package.json.


You may want to do this heroku config:set NODE_MODULES_CACHE=false from your terminal. It was what worked for us for this same error.