dugite: Git could not be found when running in electron

Git is installed, but am unable to use dugite in an electron-renderer process.

Git could not be found. This is most likely a problem in dugite itself

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 36 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I was getting a similar error - Git could not be found at the expected path, building electron with webpack using the electron-renderer target. This is due to the __dirname variable being set incorrectly. I fixed it by adding the following setting to my webpack config.

node: {
    __dirname: true
}

Webpack mocks __dirname by default resulting in just a /. True compiles __dirname to a string of the context path, and false leaves __dirname as it is in node.

@waltonseymour apologies for the delay on this. There’s an internal check that if we don’t find Git at the expected path, but of course we don’t actually include that path in the error message 🤦‍♂️ .

We expect Git to be installed atnode_modules/dugite/git/ relative to your application root, but the subdirectory path to the git executable depend on the platform you’re running on.

I’ve opened #96 to add this diagnostic message, and 1.29.0 is up on NPM which has this change. Let me know how this changes the behaviour for you.

I expect there’s some extra work here (like how we move the Git install around at package time) that you might need to do, but this should be a good first step.