Skip to content
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

Build for Windows on Mac using electron-builder #1853

Closed
DonaldChiang opened this issue May 2, 2019 · 19 comments
Closed

Build for Windows on Mac using electron-builder #1853

DonaldChiang opened this issue May 2, 2019 · 19 comments

Comments

@DonaldChiang
Copy link

Summary of Problem

(Please answer all 3)

  • What are you trying to do?
    I am trying to build a multiple platform electron app with node-serialport on Mac
  • What happens?
    Electron can run on Mac perfectly but on Windows it shows this error
A JavaScript error occurred in the main process

Uncaught Exception:
Error: \\?\C:\Users\MyUser\AppData\Local\Temp\4deb32d9-50e4.....bf7b.tmp.node is not a valid Wind32 application.

59079041_1537242819743719_6752661055807160320_n

And I am using electron-builder to build my electron app with no errors and I already run electron-rebuild every time before building.

  • What should have happened?
    It should work as Mac's version

Code to Reproduce the Issue

"serialport": "6.2.2"
"electron": "4.0.5"
"electron-builder": "20.34.0"
"electron-rebuild": "^1.8.4"

Versions, Operating System and Hardware

  • SerialPort@?
    6.2.2
  • Node.js v?
    v8.12.0
  • Windows? Linux? Mac?
    Build on macOS 10.14.3 Mojave
  • Hardware and chipset? (Prolific/FTDI/Other)
@iamsush
Copy link

iamsush commented May 2, 2019

Is it working fine before packaging it on windows?

@DonaldChiang
Copy link
Author

Thanks for reply. When I build electron on Windows it works fine. I am trying to use prebuild-install before build on Mac now but can't figured out some step, still working on it.

@iamsush
Copy link

iamsush commented May 2, 2019

Your concern is not clear to me. Could you please elaborate your issue?

@DonaldChiang
Copy link
Author

@iamsush OK, I will create a repository for reproduction on Github, thanks.

@iamsush
Copy link

iamsush commented May 2, 2019

Ok, thanks.

@DonaldChiang
Copy link
Author

DonaldChiang commented May 2, 2019

Here is the testing repository: https://github.com/DonaldChiang/node-serialport-testing

  1. clone this repository
  2. run yarn install
  3. run yarn electron:build:windows on Mac
  4. copy node-serialport-testing Setup 0.1.0.exe to Windows and install

And you can see this error

Thanks!

@iamsush
Copy link

iamsush commented May 2, 2019

Even I have had this issue, to resolve it I established my code on windows machine and it worked fine.
(Quite possible because for windows, it needs windows-build-tools and other things, I am not sure of the cause but this resolves it)

Have a look at this issue, #966. Does this resolve yours?

@DonaldChiang
Copy link
Author

Yes, I can build electron on Windows and it works fine on Windows. So now my question is:
Can I compile node-serialport on Mac(or Linux) that is for Windows? Or use prebuild to do this?

it look like I can only compile node-serialport on Windows if I want to build an electron app for Windows version

Is there any guide for setup prebuild or node-gyp for multiple platform build?

Thank you very much!

@iamsush
Copy link

iamsush commented May 2, 2019

Even I am not sure of this, Let @reconbot reply to this.

@reconbot
Copy link
Member

reconbot commented May 2, 2019 via email

@Josverl
Copy link

Josverl commented May 2, 2019

Hi pitching in cause im also interested in bundling for multiple platforms / electron

I would expect that there is a way to use the precompiled binaries that are located here :
https://github.com/node-serialport/node-serialport/releases
and therefore avoid the need for cross-compilers or running the builds on multiple platforms.

That is also mentioned in the docs 'We use prebuild to compile and post binaries of the library for most common use cases (Linux, Mac, Windows on standard processor platforms). '

But I have not been able to find clear documtation on how to make use of the posted binaries.

is my understanding correct, and if so , can you post a sample of how to use the prebuilts ?

@reconbot
Copy link
Member

reconbot commented May 2, 2019 via email

@stale
Copy link

stale bot commented Jul 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

@stale stale bot added the stale-issue label Jul 19, 2019
@danni
Copy link

danni commented Jul 24, 2019

I've run into this since trying to upgrade to Electron 5, for which there are no prebuilt packages. It looks like something between electron-builder calling node-gyp-rebuild and @serialport/bindings, something is not getting compiled.

electron-userland/electron-builder#3660 has some details, e.g. here's the result of rebuilding:

-rwxr-xr-x  1 danni  staff  201072 19 Jun 13:02 usb/build/Release/usb_bindings.node
-rwxr-xr-x  1 danni  staff  885752 19 Jun 13:02 iltorb/build/Release/iltorb.node
-rwxr-xr-x  1 danni  staff  55244 **28 Apr 00:58** @serialport/bindings/build/Release/bindings.node

electron-userland/electron-builder#4012 has a debug log:

  • rebuilding native dependencies  dependencies=@serialport/bindings@2.0.8, iltorb@2.4.3, usb@1.6.0 platform=darwin arch=x64
  • map async       taskCount=3
  • rebuilding native dependency  name=@serialport/bindings version=2.0.8
  • rebuilding native dependency  name=iltorb version=2.4.3
  • execute command  command=/usr/local/Cellar/node/12.3.1/bin/node /usr/local/Cellar/yarn/1.16.0/libexec/bin/yarn.js run install workingDirectory=/Users/danni/src/SPT/spt-bridge/node_modules/iltorb
  • execute command  command=/usr/local/Cellar/node/12.3.1/bin/node /usr/local/Cellar/yarn/1.16.0/libexec/bin/yarn.js run install
                     workingDirectory=/Users/danni/src/SPT/spt-bridge/node_modules/@serialport/bindings
  • command executed  executable=/usr/local/Cellar/node/12.3.1/bin/node out=yarn run v1.16.0
$ prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
Done in 0.27s.

@stale stale bot removed the stale-issue label Jul 24, 2019
@marceloch2
Copy link

I have the same issue with Electron 6, did you solve it @danni ?

@danni
Copy link

danni commented Aug 28, 2019

I haven't come back to it yet, sorry.

@stale
Copy link

stale bot commented Oct 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

@stale stale bot added the stale-issue label Oct 27, 2019
@danni
Copy link

danni commented Oct 28, 2019

I don't know if anything changed in the most recent update, but the most recent update permitted me to upgrade to Electron 6.

@stale stale bot removed the stale-issue label Oct 28, 2019
@stale
Copy link

stale bot commented Dec 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

@stale stale bot added the stale-issue label Dec 27, 2019
@stale stale bot closed this as completed Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants