Open iteron-yasir opened 3 years ago
I can't speak to every detail of this issue, but I believe that the error noted in point 2 is a result of the removal of config/prod.exs that was introduced in https://github.com/gutschilla/elixir-pdf-generator/pull/74
Hey, this library is in need of an update. Will do
I've latest nodejs version 15.14.0. I've created new phoenix project by
mix phx.new hello --no-webpack
. Then, I created assets folder.Inside the assets, I run
npm install chrome-headless-render-pdf puppeteer
. And added{ :pdf_generator, ">=0.6.2", compile: "make chrome" }
in mix.exs.mix deps.get pdf_generator
- It's working finemix deps.compile pdf_generator
- When i run this command. I'm getting this errormake: *** No rule to make target 'chrome'. Stop. ** (Mix) Could not compile dependency :pdf_generator, "make chrome" command failed. You can recompile this dependency with "mix deps.compile pdf_generator", update it with "mix deps.update pdf_generator" or clean it with "mix deps.clean pdf_generator"
As mentioned ReadMD, I've changed the
{:pdf_generator, "~> 0.6.2", github: "gutschilla/elixir-pdf-generator", compile: "make chrome"}
it in mix.exs. After that, I've cleaned the deps and mix deps.get and I've compiled the code bymix deps.compile pdf_generator
. Now, I'm getting this errormake: *** No rule to make target 'config/prod.exs', needed by '_build/prod'. Stop. ** (Mix) Could not compile dependency :pdf_generator, "make chrome" command failed. You can recompile this dependency with "mix deps.compile pdf_generator", update it with "mix deps.update pdf_generator" or clean it with "mix deps.clean pdf_generator"
I've tried another one method also, removed make chrome from the
mix.exs as { :pdf_generator, ">=0.6.0" }
. And installed chromiumapt-get install -y chromium-chromedriver
. Now,mix deps.compile pdf_generator
was working fine. But, when i runPdfGenerator.generate(url, generator: :chrome, prefer_local_executable: true)
. I'm getting this error{:error, {:generator_failed, "node:internal/modules/cjs/loader:927\n throw err;\n ^\n\nError: Cannot find module '/home/yasir/hello/_build/dev/lib/pdf_generator/priv/node_modules/chrome-headless-render-pdf/dist/cli/chrome-headless-render-pdf.js'\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)\n at Function.Module._load (node:internal/modules/cjs/loader:769:27)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)\n at node:internal/main/run_main_module:17:47 {\n code: 'MODULE_NOT_FOUND',\n requireStack: []\n}\n"}}
It's Working with this configuration for me. Add {:pdf_generator, "~> 0.6.2", github: "gutschilla/elixir-pdf-generator"} in to mix.exs then run
mix deps.clean pdf_generator && mix deps.get pdf_generator && mix deps.compile && mix deps.compile pdf_generator
install chromiumapt-get install -y chromium-chromedriver
I was using no-webpack project. So, I've createdassets
folder in root project directorycd assets
andnpm install chrome-headless-render-pdf puppeteer
Now go back to project root directory. Go into thedeps/pdf_generator/
then runmake priv/node_modules
. Finally, pdf generation working with this steps.What i was doing wrong in 1,2 and 3 procedure? In 4th procedure, why i need run that make command inside the deps(Correct me, if I am doing anything wrong).