5

I've seen similar questions but no real solution that worked for me yet (most users just reinstall fibers or meteor (I'm not using meteor)).

I've added the nodejs module Sync to my nodejs 0.12.6 project. It's dependency is the Fibers module that got installed automatically with Sync. Now I wanted to load Sync via require, but it fails with the message

... /win32-x64-v8-4.3/fibers.node not found

And it's correct: In sync/node_modules/fibers/bin/ is no directory named win32-x64-v8-4.3, only win32-x64-v8-4.2 and renaming didn't solve the problem (would have been too easy)...

  1. How can I solve this problem? How can this happen?
  2. What is the meaning of the last number (4.3)? I guess it's windows, 64bit, Javascript v8 engine, and then? Fibers version?

Any ideas or hints?

Update:

  • I tried to updgrade node to 0.12.6, but nothing changed.
  • I found out what the 4.3 is about, it's the v8 version. Well, when running my application with electron, it is v8: '4.3.61.21'. When checking the version with node, it is 3.28. So it's maybe electrons "fault"?

Update #2:

  • Okay i found out that electron is based on io.js and not node. That explains the different v8 versions. But still no solution. When installing fibers with latest io.js (2.3.3), it tests the 4.2 binary, but electron requires 4.3 :(

Update #3:

  • Even with the same io.js version 2.3.1 as electron, it does only install the 4.2 binary.

Update #4:

Solution:

  • See my answer below. :)
Florian Brinker
  • 735
  • 7
  • 17
  • When I suffer from Fibers binaries being misversioned, it's almost entirely because I compiled it using a different version of Node than I'm running it on. This happens a lot when I deploy. Are you doing anything special after you run npm install? – Chris Anderson Jul 04 '15 at 14:25
  • Thanks for your response. I just call *npm install sync --save-dev* (or even tried *npm install fibers...*). Afterwards i try to use it via require in my code. I tried to install it on nodejs 0.12.6 and on io.js 2.3.3. Electron runs the code with io.js 2.3.1 - but the difference is the v8 version. My io.js 2.3.3 uses the older v8-4.2 binaries too... and it's a higher version than electron uses (io.js 2.3.1 and requires v8-4.3??)... so confusing... – Florian Brinker Jul 04 '15 at 14:39
  • 1
    Two suggestions. Always use the exact version if you can; sometimes that means a world of difference. Also, v.0.12.6 isn't "stable" yet, so maybe you're running into issues there. – Chris Anderson Jul 04 '15 at 14:46
  • hmm too bad that i am a windows user... can't get nvmw to work as expected for switching default versions :/ – Florian Brinker Jul 04 '15 at 15:10
  • I'm using nvmw, too. What kind of issue do you have switching versions? – Chris Anderson Jul 04 '15 at 15:11
  • Nevermind, figured that out. it didn't set the default correctly... :) Reinstalled fibers with iojs-v2.3.1, like electron is using, but there is only the 4.2 binary again, not the 4.3 one. I guess electron is using a special version with the v8-4.3 engine. :( – Florian Brinker Jul 04 '15 at 15:17

2 Answers2

5

At the end, i had to compile fibers on my own. As described in Update #4, i've tried it before. But node-gyp always failed and i didn't notice that i have to link to the new binary file on my own...

cd ~/my-project-root/
npm install sync
cd ./node_modules/sync/node_modules/fibers
node-gyp configure
HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell

Then i've created the missing directory and moved the new binary there:

mkdir bin/win32-x64-v8-4.3
mv build/Release/fibers.node bin/win32-x64-v8-4.3/fibers.node

Now Sync works like a charm.

Florian Brinker
  • 735
  • 7
  • 17
1

You need to use the electron-rebuild tool to rebuild your native module against the version of Electron you're using

Ana Betts
  • 73,868
  • 16
  • 141
  • 209
  • Thank you, sounds interesting, but didn't work for me. I switched via nvmw to iojs 2.3.1. In my project root I installed Fibers via *npm install fibers* and then run *./node_modules/.bin/electron-rebuild* - it took a few seconds and finished (should there be any console output?). Afterwards i started the application requiring Fibers, but still the same error, there is no needed v8-4.3 binary :( – Florian Brinker Jul 05 '15 at 13:48
  • You probably need to fork fibers, instead of building the module from source it's trying to apply pre-canned ones that don't work (a few other popular modules like serialport and sqlite3 do this too :-/) – Ana Betts Jul 06 '15 at 04:53
  • Hmm i'm not sure that electron-rebuild is supposed to do. I had to compile fibers with node-gyp on my own for electron. now it is working. i will post the solution here but +1 for you anyways - thanks :) – Florian Brinker Jul 06 '15 at 12:19
  • 1
    @Florian So, for most libraries, this will work - a few node.js libraries try to be clever and ship pre-built native node modules for every flavor of node.js, instead of compiling them via node-gyp like most do. These won't work with electron-rebuild unfortunately, since most libs won't have pre-built binaries for io.js 2.3.x. However, for *most* native node libs, this is the easiest way to get it working – Ana Betts Jul 07 '15 at 04:09