Convert pdf to json using external module

Hi

I am trying to convert a pdf to json using the npm module pdf2json. I have followed the example here
https://flows.nodered.org/flow/195773d3b493d81c9bf012f64da02ea3
and modified the settings.js.
When I start NR I get this error

Error loading settings file: /home/dp/.node-red/settings.js
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/dp/.node-red/node_modules/pdf2json/pdfparser.js from /home/dp/.node-red/settings.js not supported.
Instead change the require of pdfparser.js in /home/dp/.node-red/settings.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/dp/.node-red/settings.js:434:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/node-red/red.js:140:20) {
  code: 'ERR_REQUIRE_ESM'
}

Any advice appreciated

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.