question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

package go binaries not implement

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Beacecommented, Sep 11, 2018

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.

0reactions
Beacecommented, Sep 10, 2018

I know the file path is not correct, so I add extraResources like that

"extraResources": [
  "binaries/**"
]

When I run app used command line

./Applications/MyApp.app/Contents/MacOS/myapp

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found