Comments (20)
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.
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.
@jbovenschen is this still a problem? How this can impact us?
from react-pdf.
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 ofyoga-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.
@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.
@diegomura & @jbovenschen what is the way forward with this issue? I really want to get this running. Anything I can do :)
from react-pdf.
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.
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.
@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
from react-pdf.
@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.
@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.
@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.
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.
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.
@jmjpro do you have a public fork of the updated yoga?
from react-pdf.
@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.
@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.
@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.
Made a PR which enables linux in travis again, see #143.
from react-pdf.
@diegomura will do! Thanks for letting me know.
from react-pdf.
Related Issues (20)
- [Fonts] Font family Times New Roman is not display, not work
- react-pdf isn't working in NextJS, getting "Module parse failed: Unexpected character '�'" error
- Does not render U+00B7 special character (∙)
- Bookmark in Pdf
- is it possible to present a table example? HOT 1
- Text stroke not working
- remaining margin/padding bottom should be removed on new page
- Nested text styling does not work on Windows HOT 3
- minHeight causes overlapping with fixed elements
- Copied Quickstart but kept getting this error: Cannot redefine property: BlobProvider
- 3.4.4 font changes no longer apply HOT 9
- showToolBar prop doesn't work as intended on FireFox, the toolbar is still being shown
- Conditional render if page is about to break
- Unknown version HOT 1
- Text overflows vertically when trying to render tables HOT 1
- React-PDF does not work anywhere on Next.JS HOT 1
- Vite 5 + React 18 can't render PDFViewer and give blank page in iframe due to custom fonts HOT 4
- Custom font causes infinite pending of `toBlob` HOT 1
- PDFDownloadLink not working using next js
- Vulnerability in used pdfjs-dist version HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-pdf.