Comments (20)
We got it working, by doing #2 from @vinay0x list, i.e. adding this to package.json:
"scripts": {
"build": "npm install mjml --global"
},
from mjml-rails.
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
~ $
from mjml-rails.
hmm.. even locally when I do execute npm install mjml
I seem to get that same message.
from mjml-rails.
@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
.
from mjml-rails.
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.
from mjml-rails.
@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.
from mjml-rails.
@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.
from mjml-rails.
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.
from mjml-rails.
@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
from mjml-rails.
Facing this same problem.
from mjml-rails.
@sandip-mane Do you have an example project you can point me to with the code you're running?
from mjml-rails.
@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:
- Set the MJML binary location manually - Tried setting it to `Rails.root.to_a + "/node_modules/mjml/bin/mjml" but throws the following error:
It could be failing because of how Heroku handles the build process. - Ran
yarn global add mjml
during build process -rails-mjml
still doesn't recognize it. - Tried different versions of MJML and mjml-rails
Any help would be really appreciated.
from mjml-rails.
@vinay0x Have you added a heroku build pack for it at index 1?
from mjml-rails.
@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)
from mjml-rails.
@vinay0x Have you added a heroku build pack for it at index 1?
Same here. Node.js buildpack is at index 1.
from mjml-rails.
@sandip-mane Did you try moving the heroku/ruby
build pack right below the heroku/nodejs
one?
from mjml-rails.
@sighmon Yes, I had tried doing the same with @sandip-mane but to no avail.
from mjml-rails.
@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
from mjml-rails.
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
from mjml-rails.
@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?
from mjml-rails.
Related Issues (20)
- Update GitHub actions
- [Bug] Does not find MJML executable with npm 9+ (yarn 2+ uses npm discovery) HOT 2
- Slow to render layout, and too much object(memory) Allocations HOT 1
- Prevents booting when `which` is missing HOT 8
- Can i override a layout? HOT 1
- How to custom template path? HOT 1
- Add config option for fonts HOT 1
- Fix test pipeline for Ruby 2.7
- Warning about MJML missing when using MRML HOT 5
- Database template support HOT 1
- What node packages need to make it working properly? HOT 1
- unable to load included template when using MRML HOT 3
- Support JSON MJML templates HOT 1
- Support variables as used in Mailjet HOT 6
- Fix tests
- RuboCop? HOT 2
- `Mjml::Parser#render` suppresses errors in case of Tempfile exceptions HOT 2
- Exit code in case of an error when calling the mjml binary HOT 3
- SIGKILL (signal 9) on many concurrent emails HOT 3
- How to use this library to generate a string of raw html? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mjml-rails.