Coder Social home page Coder Social logo

Comments (20)

fpjoe avatar fpjoe commented on September 26, 2024 2

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.

zalom avatar zalom commented on September 26, 2024 1

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.

joshkestenberg avatar joshkestenberg commented on September 26, 2024

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

from mjml-rails.

sighmon avatar sighmon commented on September 26, 2024

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

joshkestenberg avatar joshkestenberg commented on September 26, 2024

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.

sighmon avatar sighmon commented on September 26, 2024

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

sighmon avatar sighmon commented on September 26, 2024

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

denny avatar denny commented on September 26, 2024

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.

sighmon avatar sighmon commented on September 26, 2024

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

sandip-mane avatar sandip-mane commented on September 26, 2024

Facing this same problem.

from mjml-rails.

sighmon avatar sighmon commented on September 26, 2024

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

from mjml-rails.

vinay0x avatar vinay0x commented on September 26, 2024

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

from mjml-rails.

sighmon avatar sighmon commented on September 26, 2024

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

from mjml-rails.

sandip-mane avatar sandip-mane commented on September 26, 2024

@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

from mjml-rails.

vinay0x avatar vinay0x commented on September 26, 2024

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

sighmon avatar sighmon commented on September 26, 2024

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

from mjml-rails.

vinay0x avatar vinay0x commented on September 26, 2024

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

from mjml-rails.

sighmon avatar sighmon commented on September 26, 2024

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

fpjoe avatar fpjoe commented on September 26, 2024

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.

sighmon avatar sighmon commented on September 26, 2024

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.