sighmon / mjml-rails

MJML + ERb/Haml/Slim view template
https://mjml.io
Other
295 stars 64 forks source link

Warning about MJML missing when using MRML #117

Closed spickermann closed 6 months ago

spickermann commented 7 months ago

Hey there,

I updated mjml-rails to 4.10.0 and enabled using mrml, an option that was added in https://github.com/sighmon/mjml-rails/pull/114. At the same time, I removed the dependency on mjml from package.json.

My Gemfile includes these lines:

gem 'mjml-rails'
gem 'mrml'

And my config/initializers/mjml.rb looks like this:

Mjml.setup do |config|
  config.use_mrml = true
  config.raise_render_exception = true
  config.template_language = :erb
end

I ran my test suite and mjml-rails seems to work as expected and renders emails using mrml just fine.

But when starting the application or running the specs, this warning in put out to the console:

Couldn't find the MJML 4. binary.. have you run $ npm install mjml?

I wouldn't expect this warning when mjml-rails is configured to use mrml and mrml is installed.

johannesschobel commented 7 months ago

Dear @spickermann ,

i am seeing the same issues, although not running mrml but the "plain" mjml. I think, this issue is related to yarn. If you install mjml via npm instead of yarn, this works perfectly fine for me. However, this is kind of wonky, because the entire pipeline uses yarn.

I have described my finding in #108 so far.

Maybe you can provide additional information if you find something?

johannesschobel commented 7 months ago

i ended up running a

npm install -g mjml

in my Dockerfile that creates the image for my server to get rid of the issue. However, obviously, i am looking for a better solution ;)

sighmon commented 7 months ago

@spickermann I'm having trouble replicating it in my project. Would you be able to submit a PR for the fix?

sighmon commented 7 months ago

@spickermann Does this branch solve the warning for you? https://github.com/sighmon/mjml-rails/pull/118

spickermann commented 6 months ago

@sighmon I am sorry for not responding to your questions. Yes, the current master branch is fixing the issue. Thank you!