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

Electron and serialport on raspberry pi 3, Module version missmatch error #97

Closed
styoe opened this issue Aug 11, 2016 · 13 comments
Closed

Comments

@styoe
Copy link

styoe commented Aug 11, 2016

Python: 2.7.9
Serialport: 3.8.6
electron prebuilt: 3.8.6
raspberry 3 linux 4.4.16-v7+
Node: 5.12.0
npm: 3.8.6

I cannot get the app to run without the Module version missmatch error. I followed a bunch of tutorials here, suggesting rebuilding the module, changing node & npm & electron versions, and so far i have managed to change the error from:
"Expected 49, got 46" to "Expected 49, got 47" to "Expected 49, got 48".

Do you please have any more ideas, or point me in the right direction as i am clueless by now.

I tried clearing the npm cache, rebuilding all modules, rebuilding just serialport, deleting node modules and reinstalling them. Using node-gyp to rebuild the binaries... I think i tried every solution out there.

So far, by logging the line before the line that breaks in the node_modules/bindings/bindings.js have managed to isolate the problem ( i think ) to serialport/dist/Release/serialport.node

Here is the log:

eres-one@1.0.0 start /home/pi/eres-one/app
electron main.js

MY LOG

/home/pi/eres-one/app/node_modules/serialport/build/serialport.node
/home/pi/eres-one/app/node_modules/serialport/build/Debug/serialport.node
/home/pi/eres-one/app/node_modules/serialport/build/Release/serialport.node

END MY LOG

App threw an error during load
Error: Module version mismatch. Expected 49, got 47.
at Error (native)
at process.module.(anonymous function) as dlopen
at Object.Module._extensions..node (module.js:568:18)
at Object.module.(anonymous function) as .node
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at bindings (/home/pi/eres-one/app/node_modules/bindings/bindings.js:77:44)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Module version mismatch. Expected 49, got 47.
at Error (native)
at process.module.(anonymous function) as dlopen
at Object.Module._extensions..node (module.js:568:18)
at Object.module.(anonymous function) as .node
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at bindings (/home/pi/eres-one/app/node_modules/bindings/bindings.js:77:44)

The 46, 47, 48 versions i managed to get correlate to the node versions i installed.

46 for node < 4, 47 for node 5.* and 48 for node 6.*

The problem is that it is still 48 for the latest node arm build, and as far as i can see. te official page states
Version LTS Date V8 npm NODE_MODULE_VERSION[1]

Node.js v6.3.1 2016-07-21 5.0.71.57 3.10.3 48
https://nodejs.org/en/download/releases/

Please help me solve this,
Thanks in advance

@MarshallOfSound
Copy link
Member

@styoe node-serialport uses node-pre-gyp

This means you need to force a rebuild. You can do this by setting --build-from-source when calling node-pre-gyp.

How are you calling electron-rebuild? CLI or node API?

@styoe
Copy link
Author

styoe commented Aug 12, 2016

I tried exclusively from cli, using various options, you think that might be the problem?

@MarshallOfSound
Copy link
Member

Have you tried the node-pre-gyp fix CLI param

https://github.com/electron/electron-rebuild/blob/master/src/cli.js#L27

@styoe
Copy link
Author

styoe commented Aug 12, 2016

Yes, but i dont think the problem is there, it's in the versions of node missmatch if i am not mistaken, no? So i installed node-prebuilt and serialport, then i tried node rebuild, still the same... then i tried using node-gyp with various commands on node-serialport, still the same. then i tried rebuilding electron, still the same.
The link you posted should fix the wrong path error, not the module version missmatch error if i'm not mistaken, no?

@MarshallOfSound
Copy link
Member

@styoe The issue you are seeing (as far as I am concerned) it that electron-rebuild isn't rebuilding serialport because it uses electron-pre-gyp which downloads prebuilt binaries for different node versions.

As such it downloads the binary for your current node version which is why you saw the number increase as you increase node versions. You can force it to build from source using the node-pre-gyp install --build-from-source command that I mentioned before.

@styoe
Copy link
Author

styoe commented Aug 12, 2016

Ok, thank you. I think i already tried that but will try again in a few hours, and report the result

@styoe
Copy link
Author

styoe commented Aug 12, 2016

ok, i tried node_modules/.bin/electron-rebuild -f -w serialport -p , no luck
node_modules/.bin/electron-rebuild -f -w serialport , no luck
node_modules/.bin/electron-rebuild -f -p , no luck (this one took a while)

i also tried positioning in node_modules/serialport and running node-pre-gyp install --build-from-source and with no luck.

Funny thing is, electron-rebuild provides no console output even though my logging level is set to silly.
Is that normal?

Another thing, before rebuilding the error was thrown in ../serialport/node-modules...bindings.js and now it is thrown at (/home/pi/eres-one/app/node_modules/bindings/bindings.js:77:44
but for the same Release/serialport.node file.

@styoe
Copy link
Author

styoe commented Aug 12, 2016

i am running out of ideas here

@styoe
Copy link
Author

styoe commented Aug 14, 2016

Allright! i managed to get it working by running sudo npm rebuild --runtime=electron --target=1.2.5 --disturl=https://atom.io/download/atom-shell --build-from-source
and by bumping my electron version to 1.2.6 :)
https://www.youtube.com/watch?v=U5TqIdff_DQ
Thank you for your help

@qqnp1100
Copy link

@styoe do you solve this problem?,my Serialport module is success ,but node-usb module has zhe same problem,

@qqnp1100
Copy link

@styoe I didn't see your last reply. I try run sudo npm rebuild --runtime=electron --target=1.2.5 --disturl=https://atom.io/download/atom-shell --build-from-source
now it's working ,thanks

@styoe
Copy link
Author

styoe commented Aug 15, 2016

Np mate

@MarshallOfSound
Copy link
Member

Appears to be resolved now

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

No branches or pull requests

3 participants