NielsSteensma / Dhalang

Generate PDFs and make screenshots of HTML using Puppeteer in Ruby
MIT License
40 stars 22 forks source link

DhalangError (Cannot find module 'puppeteer' #36

Closed johnreaganmoore closed 3 years ago

johnreaganmoore commented 3 years ago

This has been working well for me locally, but after deploying to Heroku I'm am getting this error, do you have any ideas as to why this may be happening?

2021-07-26T15:57:13.885361+00:00 app[web.1]: [01ca08d1-1e0c-4fea-acee-044b5c53febc] DhalangError (Cannot find module 'puppeteer' 2021-07-26T15:57:13.885362+00:00 app[web.1]: Require stack: 2021-07-26T15:57:13.885363+00:00 app[web.1]: - /app/vendor/bundle/ruby/3.0.0/gems/Dhalang-0.6.1/lib/js/dhalang.js 2021-07-26T15:57:13.885363+00:00 app[web.1]: - /app/vendor/bundle/ruby/3.0.0/gems/Dhalang-0.6.1/lib/js/pdf-generator.js):

NielsSteensma commented 3 years ago

Hmm weird. Was "npm install puppeteer" ran on the Heroku instance? The error basically states Puppeteer is not installed.

I will try to deploy a small test app to Heroku this week to look if it works for me.

johnreaganmoore commented 3 years ago

Screen Shot 2021-07-27 at 8 36 23 AM

I'm using yarn but yeah it is seems to be installed it shows up when I run yarn --list and I see it installing during the build process

NielsSteensma commented 3 years ago

So I tested the working by deploying to Heroku a simple Rails 6 API that serves a PDF. For me that works fine if use the following buildpacks:

Therefore I don't understand why it isn't working for you. Could it be package.json and Gemfile are not in the same folder?