Convert pdf to json using external module


I am trying to convert a pdf to json using the npm module pdf2json. I have followed the example here
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) {

Any advice appreciated