React-pdf: invalid ELF header

Created on 13 Sep 2017  路  19Comments  路  Source: diegomura/react-pdf

Hi, i have an error when i run yarn example -- fractals
somebody know how to solve it?
Thanks.

yarn example v0.20.3
$ babel-node ./examples/index.js fractals
Running the fractals example
Error: ///react-pdf/packages/react-pdf/bin/7/nbind.node: invalid ELF header
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at initNode (///react-pdf/packages/react-pdf/node_modules/nbind/dist/nbind.js:141:15)
at ///react-pdf/packages/react-pdf/node_modules/nbind/dist/nbind.js:115:13
at findCompiledModule (///react-pdf/packages/react-pdf/node_modules/nbind/dist/nbind.js:79:13)
at find (///react-pdf/packages/react-pdf/node_modules/nbind/dist/nbind.js:93:13)

Most helpful comment

Reporting the same issue here @diegomura
Trying to install @react-pdf/node and @react-pdf/core from within a docker linux container to no avail. :(

All 19 comments

Resolve.

I remove the latest comma in packages/react-pdf/scripts/compileYoga.js:20
then i run yarn run build:clean yarn run precompile then yarn run build in packages/react-pdf

can you explain to me what that comma had to do with the error you got?
Maybe the issue was solved because you precompiled everything. I'm not sure if has something to do with the comma.

yarn run precompile

react-pdf/packages/react-pdf/scripts/compileYoga.js:22
);
^

SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
error Command failed with exit code 1.

Thank you for finding this, out of curiosity which version of node did you use?

With node v7.8.0 I still get the "invalid ELF header" error, even after recompiling.

Now I saw in the commits there is no "precompile" command anymore, that yoga comes compiled with the repo now ? So I can't fully apply this solution.

Anyways can we re-open the issue ?
Also does anyone have a clue what I could try to solve that ? Thanks

I'm getting the same error with node 6.11.1 and 8.5.0 running yarn example -- fractals and npm test

`/react-pdf/packages/react-pdf/bin/8/nbind.node: invalid ELF header

  at Object.Module._extensions..node (module.js:653:18)
  at Module.load (module.js:545:32)
  at tryModuleLoad (module.js:508:12)
  at Function.Module._load (module.js:500:3)
  at Module.require (module.js:568:17)
  at require (internal/module.js:11:18)
  at initNode (packages/react-pdf/node_modules/nbind/dist/nbind.js:141:15)
  at packages/react-pdf/node_modules/nbind/dist/nbind.js:115:13`

As @n-marshall said, there is no precompile command to fix this.

@jbovenschen why did you close this? Is this resolved?

I thought it was resolved with a PR a while ago, but it seems it still exist will re-open this issue.

@snettah @ChristianTracy I tried with all the versions that you said and I couldn't replicate. What OS are you using?
Try cloning again the repo, and running yarn install.
Sorry for taking that much to answer. Busy days 馃槄

Sorry for the delay @diegomura. I'm currently working in windows. I tested in powershell and with the ubuntu bash inside windows 10. Maybe the problems is the OS

Probably is. I always tested the library with macOS. We should include the Yoga binaries also builded on windows I guess. I don't have enough time to fix this right now, but thanks for reporting it. If you feel like giving a shot, please do. Thanks!

Reporting the same issue here @diegomura
Trying to install @react-pdf/node and @react-pdf/core from within a docker linux container to no avail. :(

Hi,

I ran into the same problem on my Linux machine, and managed to fix it (i.e. managed to make react-pdf create the example pdfs) by just adding a line in packages/react-pdf/package.json:

https://github.com/LGabAnnell/react-pdf/commit/7c63d31deda241f79221da9a10e9d37adb837a06#diff-24e6c26ebaf9b09b935aa692b77b392a

I haven't tested it on Windows.

I'm facing exactly this same issue on linux =/

@kaiomagalhaes thanks for reporting. This is on my top of priorities, but I couldn't work on that yet. I've been very busy this past few months, but I'm going to be free soon 馃槃

@diegomura Thanks for your answer! just something that may be important, I'm facing this issue on my linux only, on my mac it works just fine.

Removing the yarn.lock in the repo fixed this for me.

I'm currently working in a full Yoga rewrite to plain JS (https://github.com/diegomura/flexbox-js) so we can forgot about c++ compilation and issues like this one. It's just an experiment for the moment though. Yoga is great and I don't want to reinvent the wheel in here, but has been giving build problems since the beginning.

The code is a huge monolith though. Wasn't easy to translate so far 馃槗

@snettah's solution worked for me (minus the comma fix since that's irrelevant now) on a Ubuntu VM. I think a postinstall to do that sequence of commands would help.

Was this page helpful?
0 / 5 - 0 ratings