react-pdf: Cannot find module: 'yoga-layout/sync'

using “@react-pdf/renderer”: “3.0.0”, where a sudden issue has raised.

getting this error in building of the react project.

./node_modules/@react-pdf/layout/lib/index.es.js
Cannot find module: 'yoga-layout/sync'. Make sure this package is installed.

You can install this package by running: npm install yoga-layout/sync.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

@dgrigoriciuc thanks, this solution worked.

Yes. Newer version changes yoga-layout source. We had a local copy of it that was impossible to maintain and also very heavy. We are now using the official lib again, that uses exports in package.json to define entrypoints.

Using prev version of layout version will work but it’s just a patch. I recommend switching to newer node version and bundlers that resolves exports

@diegomura, I will try to do this in the future. Thank you!

no, currently we only use @react-pdf/renderer

./node_modules/@react-pdf/layout/lib/index.es.js
Module not found: Can't resolve 'yoga-layout/sync'

this is the error we are getting even while trying out in local