Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mix deps.compile not working #85

Open
iteron-yasir opened this issue Apr 18, 2021 · 2 comments
Open

mix deps.compile not working #85

iteron-yasir opened this issue Apr 18, 2021 · 2 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@iteron-yasir
Copy link

iteron-yasir commented Apr 18, 2021

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.

  1. 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 fine
    mix deps.compile pdf_generator - When i run this command. I'm getting this error
    make: *** 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"

  2. 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 by mix deps.compile pdf_generator. Now, I'm getting this error make: *** 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"

  3. I've tried another one method also, removed make chrome from the mix.exs as { :pdf_generator, ">=0.6.0" }. And installed chromium apt-get install -y chromium-chromedriver. Now, mix deps.compile pdf_generator was working fine. But, when i run PdfGenerator.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"}}

  4. 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 chromium apt-get install -y chromium-chromedriver
    I was using no-webpack project. So, I've created assets folder in root project directory
    cd assets and npm install chrome-headless-render-pdf puppeteer
    Now go back to project root directory. Go into the deps/pdf_generator/ then run make 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).

@darrenklein
Copy link

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 #74

@gutschilla
Copy link
Owner

Hey, this library is in need of an update. Will do

@gutschilla gutschilla added the dependencies Pull requests that update a dependency file label Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

3 participants