Szpadel / chrome-headless-render-pdf

225 stars 67 forks source link

Can't find Chrome on Ubuntu #66

Closed gabalicious closed 4 years ago

gabalicious commented 4 years ago

Works great on Mac but when I run in prod I get the following error when trying to run cli.

Error: Couldn't detect chrome version installed! use --chrome-binary to pass custom location
    at RenderPDF._callee10$ (/home/justin/.nvm/versions/node/v12.16.2/lib/node_modules/chrome-headless-render-pdf/dist/index.js:665:39)
    at tryCatch (/home/justin/.nvm/versions/node/v12.16.2/lib/node_modules/chrome-headless-render-pdf/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/home/justin/.nvm/versions/node/v12.16.2/lib/node_modules/chrome-headless-render-pdf/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.<computed> [as next] (/home/justin/.nvm/versions/node/v12.16.2/lib/node_modules/chrome-headless-render-pdf/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/home/justin/.nvm/versions/node/v12.16.2/lib/node_modules/chrome-headless-render-pdf/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /home/justin/.nvm/versions/node/v12.16.2/lib/node_modules/chrome-headless-render-pdf/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13

I tried to add dependencies with this install command but still get the same error

sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
gabalicious commented 4 years ago

npm i chromium-browser -g fixed the issue