React-pdf/renderer vs meteor

Hi all,

trying to update my react-pdf/renderer in my meteor 2.8.0 project to the latest release (3.0.0). My react ui will not render after the update due to the error below. There’s also a post on stack overflow: reactjs - I am trying to integrate @react-pdf/renderer in my proyect and I get this error: "Uncaught TypeError: module.runSetters is not a function" - Stack Overflow

I’d really like to keep up with the latest version of the renderer, due to some memory issues in older versions.

Any ideas?

module.runSetters is not a function
    at buildCallerFunction (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:388592:318)
    at Object.makeCaller (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:388650:69)
    at BindClass.registerMethods (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:388386:33)
    at BindClass.registerSuperMethods (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:388399:15)
    at BindClass.finish (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:388407:71)
    at __nbind_finish (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:388235:40)
    at $A (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:395371:19)
    at _A (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:395309:7)
    at Object.ccallFunc [as ccall] (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:387407:23)
    at Object.onRuntimeInitialized (modules.js?hash=26231fce43d40ac065ad11db8fd1a749ed56c3e1:387163:16)

Ok, thanks to this thread here @react-pdf/renderer: module.runSetters is not a function · Issue #12179 · meteor/meteor · GitHub I solved it by recompiling @react-pdf/renderer by adding this to my package.json:

"meteor": {
    "mainModule": {
      "client": "client/main.jsx",
      "server": "server/main.js"
    },
    "testModule": "tests/main.js",
    "nodeModules": {
      "recompile": {
        "@react-pdf/renderer": true
      }
    }
  },

EDIT; Ok needed to remove the “Solved” tag from the title. Had it working on one dev machine locally, it did not work on a different machine and also on a staging environment on scalingo using their build system did not succeed, error on the client as in my first post here.

Hey @bratelefant have you faced this problem:

Module not found: Can’t resolve ‘yoga-layout’?

Any solutions?

I have seen this issue with latest versions of the package.

Try using this versions, this are working for me.

"@react-pdf/layout": "3.6.3",
"@react-pdf/renderer": "3.1.14",


I nuked node_modules and package.lock.json, then meteor npm install, but I still get the error

What’s getting installed? Can you check your lock file and see what versions end up installed?

/// package-lock.json
@react-pdf/layout”: “^3.6.3”, /// with ^ :frowning:
@react-pdf/renderer”: “3.1.14”,

"node_modules/@react-pdf/layout": {
  "version": "3.12.1",
  "resolved": "https://registry.npmjs.org/@react-pdf/layout/-/layout-3.12.1.tgz",
  "integrity": "sha512-BxSeykDxvADlpe4OGtQ7NH46QXq3uImAYsTHOPLCwbXMniQ1O3uCBx7H+HthxkCNshgYVPp9qS3KyvQv/oIZwg==",
  "dependencies": {
    "@babel/runtime": "^7.20.13",
    "@react-pdf/fns": "2.2.1",
    "@react-pdf/image": "^2.3.6",
    "@react-pdf/pdfkit": "^3.1.10",
    "@react-pdf/primitives": "^3.1.1",
    "@react-pdf/stylesheet": "^4.2.5",
    "@react-pdf/textkit": "^4.4.1",
    "@react-pdf/types": "^2.5.0",
    "cross-fetch": "^3.1.5",
    "emoji-regex": "^10.3.0",
    "queue": "^6.0.1",
    "yoga-layout": "^2.0.1"
  }
},

what to try next :thinking:

Found a solution, not sure if everything here is necessary. It works for now, I dont want to touch it

/// package.json under dependencies
@react-pdf/layout”: “3.6.3”,
@react-pdf/textkit”: “4.3.0”,
@react-pdf/image”: “2.2.2”,
@react-pdf/pdfkit”: “3.1.2”,
@react-pdf/renderer”: “3.1.12”,

},
“overrides”: {
@react-pdf/layout”: “3.6.3”,
@react-pdf/textkit”: “4.3.0”,
@react-pdf/image”: “2.2.2”,
@react-pdf/pdfkit”: “3.1.2”,
@react-pdf/renderer”: “3.1.12”
}

Gotta love pdf:s :laughing: :melting_face:

1 Like