skip to Main Content

When I try to install PagedJS with the recommended npm install -g pagedjs-cli pagedjs I get:

npm WARN deprecated @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when neded). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated [email protected]: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 enginewhims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /root/.nvm/versions/node/v14.17.5/lib/node_modules/pagedjs-cli/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! internal/modules/cjs/loader.js:905
npm ERR!   throw err;
npm ERR!   ^
npm ERR!
npm ERR! Error: Cannot find module '/root/.nvm/versions/node/v14.17.5/lib/node_modules/pagedjs-cli/node_modules/puppeteer/install.js'
npm ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
npm ERR!     at internal/main/run_main_module.js:17:47 {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: []
npm ERR! }

If I run npm install -g puppeteer I get the exact same error (minus the warnings).

I tried a local install with npm install pagedjs-cli pagedjs and everything went fine (when I run npm ls I get:

├── [email protected]
├── [email protected]
└── [email protected]

which seems to indicate that the relevant packages were successfully installed locally). But when I try to run PagedJS with npx pagedjs-cli example.html -o result.pdf I get:

Loading: example.htmlError: Failed to launch the browser process!
/home/sophivorus/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
    at onClose (/home/sophivorus/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
    at Interface.<anonymous> (/home/sophivorus/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:187:68)
    at Interface.emit (events.js:412:35)
    at Interface.close (readline.js:530:8)
    at Socket.onend (readline.js:254:10)
    at Socket.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

I then tried installing the missing library with yum install libatk-bridge-2.0.so.0 and everything went fine (when I run ldconfig -p | grep libatk-bridge-2.0.so.0 I get:

libatk-bridge-2.0.so.0 (libc6) => /lib/libatk-bridge-2.0.so.0

which seems to indicate that the library was successfully installed). However when I retry npx pagedjs-cli example.html -o result.pdf I get the exact same error. If I avoid npx with /home/sophivorus/node_modules/.bin/pagedjs-cli example.html -o result.pdf I get the same error.

I’m on CentOS 7 and running the latest node and npm:

node -v
v17.0.1

npm -v
8.1.0

I also tried with the latest LTS version. Thanks for any help!

2

Answers


  1. The library you are trying to use (pagedjs) seems to be very incomplete, based on outdated and deprecated versions of other libraries and maintained by just one developer. It has just around 100 commits in total. I would advice to switch to jsPDF. It has more then 4000 forks and I’m completely silent about commits. It’s actively maintained and very popular. Nevertheless, It’s just first what I found. Maybe you can find even better library…

    This question might help you as well:
    Generate pdf from HTML in div using Javascript

    Login or Signup to reply.
  2. The package has another name …

    repoquery --list at-spi2-atk.x86_64
    

    lib and lib64 are not the same thing:

    • ldd /usr/lib64/libatk-bridge-2.0.so.0.0.0
    • ldd /lib/libatk-bridge-2.0.so.0
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search