Search code examples
node.jssynchronizationelectronnode-fibers

Nodejs (Sync) cannot find fibers binaries


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. :)

Solution

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