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

followed all steps for heroku but still getting missing binary message. #49

Open
joshkestenberg opened this issue Mar 28, 2019 · 20 comments

Comments

@joshkestenberg
Copy link

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?

@joshkestenberg
Copy link
Author

hmm.. even locally when I do execute npm install mjml I seem to get that same message.

@sighmon
Copy link
Owner

sighmon commented Mar 28, 2019

@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.

@joshkestenberg
Copy link
Author

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.

@sighmon
Copy link
Owner

sighmon commented Mar 30, 2019

@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.

@sighmon
Copy link
Owner

sighmon commented Mar 30, 2019

@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.

@denny
Copy link

denny commented Nov 28, 2020

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.

@sighmon
Copy link
Owner

sighmon commented Nov 29, 2020

@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

@sandip-mane
Copy link

Facing this same problem.

@sighmon
Copy link
Owner

sighmon commented Feb 28, 2021

@sandip-mane Do you have an example project you can point me to with the code you're running?

@vinay0x
Copy link

vinay0x commented Feb 28, 2021

@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

Screenshot 2021-02-28 at 9 25 59 AM

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
    It could be failing because of how Heroku handles the build process.
  2. Ran yarn global add mjml during build process - rails-mjml still doesn't recognize it.
  3. Tried different versions of MJML and mjml-rails

Any help would be really appreciated.

@sighmon
Copy link
Owner

sighmon commented Mar 3, 2021

@vinay0x Have you added a heroku build pack for it at index 1?

@sandip-mane
Copy link

sandip-mane commented Mar 3, 2021

@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)

image

@vinay0x
Copy link

vinay0x commented Mar 3, 2021

@vinay0x Have you added a heroku build pack for it at index 1?

Same here. Node.js buildpack is at index 1.

@sighmon
Copy link
Owner

sighmon commented Mar 14, 2021

@sandip-mane Did you try moving the heroku/ruby build pack right below the heroku/nodejs one?

@vinay0x
Copy link

vinay0x commented Mar 15, 2021

@sighmon Yes, I had tried doing the same with @sandip-mane but to no avail.

@sighmon
Copy link
Owner

sighmon commented Mar 24, 2021

@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

@fpjoe
Copy link

fpjoe commented Jul 22, 2021

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

@sighmon
Copy link
Owner

sighmon commented Jul 23, 2021

@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?

@fpjoe
Copy link

fpjoe commented Jul 23, 2021

We got it working, by doing #2 from @vinay0x list, i.e. adding this to package.json:

  "scripts": {
    "build": "npm install mjml --global"
  },

@zalom
Copy link

zalom commented Nov 17, 2022

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 [email protected] to run at the end (the solution from above -> #49 (comment)) 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 -> #35 (comment).

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
~ $

zalom referenced this issue in marketertechnologies/heroku-slug-cleaner Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants