Fixing the EISGIT npm appears to be a git repo or submodule Error.

William Okafor
2 min readMar 23, 2019

--

This happened when i was deploying an app to heroku.

Code debugging is a special skill.

So i’d start by explaining my scenario to help you understand if yours is similar.

A module in the node_modules folder had a .git folder and after I deleted one, I ended up finding other folders having the same .git folder, and even after Icrawled down that rabbit hole to carefully delete all the problematice .git folders, every time Itried pushing to heroku, the error popped up again.

So I had to delete the entire node_module and allow heroku rebuild the project with the following steps

The Fix

Run heroku run bash to get into a bash terminal where you would have access to your project’s files

Then rm -rf node_modules to completely delete the node_modules directory

Exit bash.

Run heroku config:set NODE_MODULES_CACHE=false to ensure heroku doesn’t try to use a cache in rebuilding your node_modules

Push the project again to heroku.

That solved the problem for me.

Also you should set node_modules_cache back to true once the previous steps have been completed.

And that’s it. I hope this helps you out and saves you some good debugging time. If it did, please play with the clap button 50 times to help this guide reach other people in a similar bind.

Thanks for reading, Cheers!

--

--