Open joshkestenberg opened 5 years ago
hmm.. even locally when I do execute npm install mjml
I seem to get that same message.
@joshkestenberg perhaps try the latest version in package.json
:
"dependencies": {
"mjml": "~4.3.1"
},
I don't have a lot of experience with npm either, but maybe try installing it globally with npm install -g mjml
and then test that you can access mjml on the command line in your rails directory with mjml --version
.
I tried both updating package.json
and global install, and the outcome hasn't changed. mjml --version
yields:
mjml-core: 4.4.0-beta.1
mjml-cli: 4.4.0-beta.1
I appreciate the help. I'll wait til I actually start using the library to see whether or not the message I'm receiving is actually an indication that it's not working, or just a bug in and of itself.
@joshkestenberg Ah, you're on the beta - I wonder if io.read.include?
works for a beta tag like that. https://github.com/sighmon/mjml-rails/blob/master/lib/mjml.rb#L18
I've only ever tested against release versions.
@joshkestenberg I tried it on the command line... maybe you can try this too and see if it works for you:
rails c
IO.popen("mjml --version") { |io| io.read.include?("mjml-core: 4.") }
=> true
To simulate the beta I used:
rails c
"mjml-core: 4.4.0-beta.1".include?("mjml-core: 4.")
=> true
So it still seems as though your Ruby environment can't see mjml
at all.
I have this warning on every deploy on Heroku, but the mjml stuff in my app actually works fine. I think it's something to do with the order the node stuff installs but I'm not sure, and the config changes I tried made no difference... I gave up worrying about it in the end.
@denny Does 4.6.0
allowing you to set the path to the binary help?
# config/initializers/mjml.rb
Mjml.setup do |config|
config.mjml_binary = "/path/to/custom/mjml"
end
Facing this same problem.
@sandip-mane Do you have an example project you can point me to with the code you're running?
@sighmon I work with @sandip-mane and we've been trying to fix the issue for a week now. I've created another sample repo which we use as a base for all our projects, and I've added MJML to it. It's a Heroku-ready repository and it also faces the same issue. https://github.com/vinay0x/wheel
Things we've tried:
1) Set the MJML binary location manually - Tried setting it to Rails.root.to_a + "/node_modules/mjml/bin/mjml" but throws the following error: ![image](https://user-images.githubusercontent.com/10897109/109407495-37f16b80-79a7-11eb-965d-b75ad5288049.png) It could be failing because of how Heroku handles the build process. 2) **Ran
yarn global add mjmlduring build process** -
rails-mjml` still doesn't recognize it.
3) Tried different versions of MJML and mjml-rails
Any help would be really appreciated.
@vinay0x Have you added a heroku build pack for it at index 1?
@sighmon Yes, the nodejs
buildpack is at index 1. (This is from the app on which I am facing the issue. Not the sample app deployed by @vinay0x)
@vinay0x Have you added a heroku build pack for it at index 1?
Same here. Node.js buildpack is at index 1.
@sandip-mane Did you try moving the heroku/ruby
build pack right below the heroku/nodejs
one?
@sighmon Yes, I had tried doing the same with @sandip-mane but to no avail.
@sandip-mane @vinay0x When you bash
into Heroku, is there any sign of mjml
manually? Here's what I see:
$ heroku run bash -a newint
Running bash on ⬢ s... up, run.4106 (Standard-1X)
~ $ which mjml
/app/node_modules/.bin/mjml
We're having the same issue, getting the same errors. Tried most of the same things mentioned by @vinay0x (1 and 3, was about to try 2). Currently trying 4.6.1 of the gem and npm package.
When I bashed into Heroku, I got:
$ heroku run bash -a xxxxxx
Running bash on ⬢ xxxxxx... up, run.5882 (Standard-1X)
~ $ which mjml
~ $ mjml
bash: mjml: command not found
@fpjoe What do you see during a deployment for this section:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote: 1. heroku/nodejs
remote: 2. heroku/ruby
remote: -----> Node.js app detected
Are you running more than two buildpacks? Is nodejs definitely first in your deploy logs?
We got it working, by doing #2 from @vinay0x list, i.e. adding this to package.json:
"scripts": {
"build": "npm install mjml --global"
},
This can help as well.
We used a slug cleaner build pack on Heroku, and we removed node_modules
in the process. Effectively introducing the
Couldn't find the MJML 4.0. binary.. have you run $ npm install mjml?
message.
The trick was to add npm install mjml@4.9.0
to run at the end (the solution from above -> https://github.com/sighmon/mjml-rails/issues/49#issuecomment-885827868) would not work for us because our cleaner was the last build pack.
In the end, we forked the desired build pack and then ran the install of MJML version 4.9.0. If you have a mismatch in versions, it will not work -> https://github.com/sighmon/mjml-rails/issues/35#issuecomment-404491234.
To check the version of Mjml, we used ->
irb(main):004:0> Mjml.mjml_binary_version_supported
=> "4.9.0"
And to verify that it finds the executable we used ->
irb(main):001:0> mjml_bin = `which mjml`.chomp
=> "/app/node_modules/.bin/mjml"
irb(main):003:0> Mjml.check_version(mjml_bin)
=> false
Also checking things from bash ->
~ $ which mjml
/app/node_modules/.bin/mjml
~ $ mjml --version
mjml-core: 4.6.0
mjml-cli: 4.6.0
~ $
I followed the Heroku instructions by adding the node buildpack and package.json but I'm still seeing a message about an unfound binary.
My package.json reads:
{ "name": "appname", "version": "1.0.0", "dependencies": { "mjml": "^4.0.0" } }
and there is no error thrown in the node build, but I still see:
"Couldn't find the MJML binary.. have you run $ npm install mjml? "
when initialising the rails app. I have yet to write any mjml so I don't know whether or not the pacakge is working, and I don't have a lot of experience with npm. Do you have an advice for me?