-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git could not be found when running in electron #96
Comments
@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 at I've opened #96 to add this diagnostic message, and 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. |
Hey @shiftkey thanks for getting back to me. I checked in I'm assuming something is wrong with the path to the binary in the renderer process, whether it be webpack or something else. |
Let me know what error you do see. A recent change in #85 introduced a |
I run into this problem too, but the official github desktop is working fine. I doubt it is caused by packager (using electron-builder) config error. But I can't find it for now. |
@gengjiawen this is probably because we explicitly copy the package into the output folder before packaging, and then set the environment variable in the renderer process. For other setups or tools, I'm happy to provide some documentation and guidance but I need examples that I can work with so I can ensure I'm documenting the right setup. |
If you are interested, you can check this repo, https://github.com/gengjiawen/desktop. You can fork this repo and add those two lines back, gengjiawen/desktop@6b156ad. If you run the app, clone a repo, it's will raise a ENOENT error indicating the git exe is not exist, but it actually exist. |
If you want to check the exe only, you can download binary here, https://github.com/gengjiawen/desktop/releases. I have remove the minify in production mode. You can check the log in develop tools. |
I change a little source code to debug. I find it even if the process.env.LOCAL_GIT_DIRECTORY path not exist, it still use it. But the hot reloading is not working on this project (a little complicated for me). I will do more test using vue with electron. function resolveGitDir() {
if (process.env.LOCAL_GIT_DIRECTORY) {
console.log('using local');
return path.resolve(process.env.LOCAL_GIT_DIRECTORY);
}
else {
const s = path.sep;
const gitDir = path.resolve(__dirname, '..', '..', 'git')
.replace(/[\\\/]app.asar[\\\/]/, `${s}app.asar.unpacked${s}`);
console.log(gitDir);
return gitDir;
}
} |
I have write a demo https://github.com/gengjiawen/dugite-vue. And when bundled in dir (run
|
@gengjiawen your repro is related to ASAR being enabled by default when you invoke I'm still digging into the root cause - there's lots of optimizations I've needed to unwind. EDIT: here's my changes on top of master to get to this error.
And now we have this error:
This is something that @paulcbetts had a shot at fixing recently, but I don't think he succeeded. I think the dependency on
|
The |
Electron will unpack the necessary contents from the ASAR archive that it thinks it needs at runtime. Looking at this current build, it seems like everything is there that it should need:
And just before launching And then I get the error with the
That's this code, which looks fine for Linux.
The |
I don't quite follow you, If i replace the And if you go to the dir like |
Aha, this is the bit I was missing. I assumed
This is because you need to set |
Looks like the ASAR unpacking is ignoring shortcuts. This is from the unpacked And this is from the unpacked
|
You won't believe it, change the repo url to http, and everything works... |
@gengjiawen cool - sounds like this should all just work if we can tell the ASAR packing to also include shortcuts! |
I am not following you again, https still not works for now. Why would http and https works on |
I see, it's not bunding git-remote-https. |
Precisely. Digging into whether this is a limitation of |
@gengjiawen and here's the issue - electron-userland/electron-builder#1376 |
set |
@gengjiawen yes, and that's what we're doing in Desktop currently. I'd love to fix this properly so we can enable this behaviour, so I'm gonna go down this rabbit hole and see if I can propose a patch to |
As you might know, I have fork the desktop and change the packager to electron-builder to use travis to build linux distro. To achieve this , do i need to comment this line : process.env['LOCAL_GIT_DIRECTORY'] = Path.resolve(__dirname, 'git') |
@gengjiawen I'm not sure if you can remove it, but it's probably the wrong path for your setup |
@gengjiawen |
Okay, but i will stay with electron-builder since it has many convenient feature, such as publish to github release and aws. |
Hey, I find that on desktop, You need to change the source code this to make it it work, it looks like the function resolveGitDir() {
if (process.env.LOCAL_GIT_DIRECTORY) {
console.log('using env');
return path.resolve(process.env.LOCAL_GIT_DIRECTORY);
}
else {
console.log(`using guess dirname ${__dirname}`);
const s = path.sep;
const dir = path.resolve(__dirname, '..', 'node_modules', 'dugite', 'git').replace(/[\\\/]app.asar[\\\/]/, `${s}app.asar.unpacked${s}`);
console.log(dir);
return dir;
}
} |
@gengjiawen so the problem isn't with either packager, but with the |
Are you running this with |
nope |
Are you moving Git or the related JS files around during your build process? What's |
I didn't move anything. In In Maybe it's related to webpack config when get Anyway, using |
If this turns out related to webpack config. I think we may need to fix this. |
I was getting a similar error -
Webpack mocks |
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
The text was updated successfully, but these errors were encountered: