package go binaries not implement
See original GitHub issueI want to run the go binary file for the simple server in the child process. The dev mode is working, but the server not start and can not connect 127.0.0.1:3000 after package.
Here is my code.
child.js
import path from 'path';
import childProcess from 'child_process';
const child = () => {
const node = childProcess.execFile(path.join(__dirname, './gobinaries'), [], {
cwd: process.cwd()
});
node.stdout.on('data', data => {
console.log(`stdout: ${data}`);
});
node.stderr.on('data', data => {
console.log(`stderr: ${data}`);
});
node.on('close', code => {
console.log(`child process exited with code ${code}`);
});
};
module.exports = child;
main.dev.js
import childProcess from './child';
app.on('ready', async () => {
...
mainWindow = new BrowserWindow({
show: false,
width: 1000,
minWidth: os.platform() === 'win32' ? 800 : 1000,
minHeight: os.platform() === 'win32' ? 600 : 750,
frame: false,
height: 750,
title: 'myapp',
backgroundColor: '#fff',
});
...
childProcess();
});
package.json
"build": {
"files": [
"dist/",
"node_modules/",
"app.html",
"main.prod.js",
"main.prod.js.map",
"package.json",
"gobinaries"
]
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Binaries installed via go install are not accessible on path #27
I use golint and goimports, both tools installed via go install . These binaries are not found on any OS that I've tried,...
Read more >go install not creating binary of a package while go get is able to
When the package godog is installed using go get github.com/DATA-DOG/godog/ , godog executable is created inside $GOPATH/bin/. All fine till now ...
Read more >How To Build and Install Go Programs - DigitalOcean
To do this, you can use the Go toolchain to build and install your program. In Go, the process of translating source code...
Read more >Deprecation of 'go get' for installing executables
Starting in Go 1.17, installing executables with go get is deprecated. go install may be used instead. In Go 1.18, go get will...
Read more >Everything you need to know about Packages in Go - Medium
a file inside pkg directory. We can not execute this file as it's not a binary executable file. Package naming convention. Go community...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have found the reason, the go binaries connected sqllite.db, when server started the db path was not correct. So I solved the problem by pass an env variable of db path to go binaries.
I know the file path is not correct, so I add extraResources like that
When I run app used command line
It worked!!!
But, direct opening app is always not working.Electron didn’t respond. It didn’t seem to have been executed, or the sub process blocked the main process.