Code Monkey home page Code Monkey logo

Comments (20)

jbovenschen avatar jbovenschen commented on May 13, 2024

Emcscripten which is used to compile yoga-layout can not be used on Linux, this because of that it compile CLang from it's sources.

Check this for more info.

from react-pdf.

jbovenschen avatar jbovenschen commented on May 13, 2024

Yoga does work with the new release without needing a build step, but this will be triggered by scripts inside the package.json, does not know if we could ignore them for a single package? @diegomura you have any idea?

from react-pdf.

diegomura avatar diegomura commented on May 13, 2024

@jbovenschen is this still a problem? How this can impact us?

from react-pdf.

jbovenschen avatar jbovenschen commented on May 13, 2024

This is still an issue, and can be solved in two ways.

Main issue is that yoga-layout depends on emscripten which dependencies are not correctly installed on every OS or PC.

  • Yoga-layout provides a precompiled version of the library
  • We make a bundled release of react-pdf with an compiled version of yoga-layout

Sort of something I would like to do, providing a flat bundle like react is going to do in the future.

from react-pdf.

ferdinandsalis avatar ferdinandsalis commented on May 13, 2024

@diegomura I just ran across this error when I deployed my app on now.

> micro: Error when importing /home/nowuser/src/build/index: Error: Error relocating /home/nowuser/src/node_modules/yoga-layout/build/Release/nbind.node: YGAlignToString: symbol not found
>     at Object.Module._extensions..node (module.js:598:18)
>     at Module.load (module.js:503:32)
>     at tryModuleLoad (module.js:466:12)
>     at Function.Module._load (module.js:458:3)
>     at Module.require (module.js:513:17)
>     at require (internal/module.js:11:18)
>     at initNode (/home/nowuser/src/node_modules/nbind/dist/nbind.js:141:15)
>     at /home/nowuser/src/node_modules/nbind/dist/nbind.js:115:13
>     at findCompiledModule (/home/nowuser/src/node_modules/nbind/dist/nbind.js:79:13)
>     at find (/home/nowuser/src/node_modules/nbind/dist/nbind.js:93:13)
>     at Object.init (/home/nowuser/src/node_modules/nbind/dist/nbind.js:104:5)
>     at Object.<anonymous> (/home/nowuser/src/node_modules/yoga-layout/sources/entry-node.js:11:17)
>     at Module._compile (module.js:569:30)
>     at Object.Module._extensions..js (module.js:580:10)
>     at Module.load (module.js:503:32)
>     at tryModuleLoad (module.js:466:12)

I guess this is related to this issue or am I mistaken? If yes shouldn’t we reopen the issue?

from react-pdf.

ferdinandsalis avatar ferdinandsalis commented on May 13, 2024

@diegomura & @jbovenschen what is the way forward with this issue? I really want to get this running. Anything I can do :)

from react-pdf.

diegomura avatar diegomura commented on May 13, 2024

I couldn't get into this issue in detail yet, but @jbovenschen had some good ideas above. Releasing react-pdf with a compiled version of yoga sounds like the way to go for me, but not sure.

I also don't know if there should be a compiled version for each node version or not, because I was forced once to rebuild yoga when I updated my node version

from react-pdf.

codepunkt avatar codepunkt commented on May 13, 2024

What exactly is yoga used for? I'm not sure i understand the benefits it brings - as opposed to manually adding some flexbox styles?

from react-pdf.

ferdinandsalis avatar ferdinandsalis commented on May 13, 2024

@codepunkt if I am not mistaken yoga is a layout engine that uses the flexbox spec. And since we dont use a browser we need yoga. And flexbox is great since we dont want be adding coordinates (this is what pdfkit does; which is what react-pdf uses under the hood to do all the nasty font stuff and so on) to all the objects we want to place in the document. @diegomura or @jbovenschen correct me if I am wrong ☺️

PS. I am still so excited about this project and would love to use it in my project, which currently uses pdfkit. Somehow generating good looking pdfs is strangly fullfilling ☺️ and it would be way more awesome with the magic of react and yoga. Would you guys be open to having a slack channel for pdf-kit?

from react-pdf.

diegomura avatar diegomura commented on May 13, 2024

@ferdinandsalis thanks for addressing this. What you said is right. manually adding some flexbox styles is not as simple as it sounds: you have to deal with tons of different scenarios, calculate coordinates for many elements inside a flex container that can stretch or align based on many different properties. That's why we use yoga. Since it's written in C, this is done in a very efficient way.

Unfortunately we still have this issue, though. I'm going to vacations tomorrow, so I will not be around for some weeks. I'll try to catch up with the project, but I won't be able to code from there. if this is a blocker for you @ferdinandsalis , I promise that I'll try to address this issue as soon as I return 😄

from react-pdf.

jbovenschen avatar jbovenschen commented on May 13, 2024

@emilsjolander seems this is a bit of an issue in our library, is there any change that yoga could publish also compiled versions on npm?

from react-pdf.

ferdinandsalis avatar ferdinandsalis commented on May 13, 2024

@diegomura awesome. I Would love to tackle this myself but I currently lack the time and technical expertise — all I can do for now is donate some money through open collective. @diegomura have a great vacation and I look forward to what you are up to with react-pdf once you are back. However if someone else has time to tackle this issue it would be greatly appreciated.

from react-pdf.

diegomura avatar diegomura commented on May 13, 2024

Thanks man! your contribution through open-collective is really appreciate it, honestly.
And of course, if someone wants to tackle this issue, please do!

from react-pdf.

jmjpro avatar jmjpro commented on May 13, 2024

This sounds like one of the main reasons the README lists this library as not production ready... :-)

I manually updated yoga to bypass this for now as per the instructions in facebook/yoga#588 (comment)

from react-pdf.

eliseumds avatar eliseumds commented on May 13, 2024

@jmjpro do you have a public fork of the updated yoga?

from react-pdf.

jbovenschen avatar jbovenschen commented on May 13, 2024

@jmjpro Yes this is one of the reasons we list this library as non-production ready, besides that we have to figure out a good way to support multiple platforms.

If anyone knows a way to provide a compiled bundle of yoga I'm happy to do so.

from react-pdf.

jmjpro avatar jmjpro commented on May 13, 2024

@jbovenschen have you looked at https://github.com/mapbox/node-pre-gyp? I discovered it via this article: https://cylonjs.com/blog/2014/11/19/creating-multiplatform-precompiled-binaries-for-node-modules/.

from react-pdf.

diegomura avatar diegomura commented on May 13, 2024

@ferdinandsalis can you try the beta version v0.4.5 and see if works now? I think I fix this issue (at least partially). @jbovenschen said that he tested in Linux and worked

from react-pdf.

jbovenschen avatar jbovenschen commented on May 13, 2024

Made a PR which enables linux in travis again, see #143.

from react-pdf.

ferdinandsalis avatar ferdinandsalis commented on May 13, 2024

@diegomura will do! Thanks for letting me know.

from react-pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.