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

install-app-deps compiles to wrong node module version #4012

Closed
hingobway opened this issue Jul 3, 2019 · 4 comments
Closed

install-app-deps compiles to wrong node module version #4012

hingobway opened this issue Jul 3, 2019 · 4 comments
Labels

Comments

@hingobway
Copy link

  • Version: 20.44.4
  • Target: Windows NSIS

Description

Working on a project using serialport (through johnny-five), code works perfectly after using ./node_modules/.bin/electron-rebuild, but running electron-builder install-app-deps seems to compile serialport to node module version 47, well behind the desired version of 70. It breaks the app both in development and after packaging.

I also tried packaging the app after using just electron-rebuild, but this results in the exact same error.

Raw Errors

The error in development without using electron-rebuild or install-app-deps (72->20):
dev no compile
The error in development after adding install-app-deps as postinstall script (47->70):
builder no compile
The error after packaging, using electron-rebuild or install-app-deps (47->70):
build no matter what

Other relevant versions

Node 12.5.0
yarn 1.16.0

electron 5.0.6
electron-rebuild 1.8.5
serialport 7.1.5
johnny-five 1.1.0

@develar
Copy link
Member

develar commented Jul 3, 2019

Please use 21.0.7

@develar develar closed this as completed Jul 3, 2019
@develar develar added the bug label Jul 3, 2019
@roydejong
Copy link

Downgrading to v21.0.7 didn't fix this issue for me, but I did find a workaround, in case anyone is looking for one.

I did notice that running electron-rebuild manually resulted in the correct bindings.node (v70) being generated, in my case at the following path:

node_modules\@serialport\bindings\bin\win32-x64-70\bindings.node

If you copy that file over to the build directory and overwrite the bad version, and then modify the permissions to be read only:

image

Then electron-builder will ignore it and leave your version intact (silently - which is a bit worrying), which should allow things to work :)

It's really stupid and inconvenient, but it's the only thing I got to work for packaging the application, and I really needed to ship today so there you go. 🤷‍♂️

@danni
Copy link

danni commented Jul 23, 2019

21.1.1 doesn't appear to fix this issue for me. It definitely seems that the wrong thing or nothing(?) is being compiled.

buildDependenciesFromSource is true.

$ find node_modules/@serialport/bindings/ -name *.node
node_modules/@serialport/bindings//build/Release/bindings.node
$ ls -ltr node_modules/@serialport/bindings//build/Release/bindings.node
-rwxr-xr-x  1 danni  staff  55244 28 Apr 00:58 node_modules/@serialport/bindings//build/Release/bindings.node

(note the date)

  • 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.

No output seems pretty suss to me. I think this is working in Electron 4 because it has previously used prebuilt to install a binary.

@townmi
Copy link

townmi commented Dec 23, 2019

update electronVersion electronDownload in your electron-builder.json, than electron-builder will rebuild your native dependency correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants