Closed keithlayne closed 1 year ago
@keithlayne Thanks for finding that bug - looks like the last GitHub Action ran with node 18 and npm 8.19.3 https://github.com/sighmon/mjml-rails/actions/runs/3965640687/jobs/6795562473#step:4:11
Would you like to create a PR with your solution that has a new matrix of npm versions to test?
Might also be worth adding your initialiser solution to the README.
Sorry, I meant to look at this over the weekend, but I just had an idea, which seemed to work. This is probably more in the readme category, but I tried:
Mjml.setup do |config|
config.mjml_binary = 'yarn mjml'
end
...and this worked (with yarn 3). Bonus here is that it ought to work with yarn if you're not using node_modules (I'm not sure what yarn bin
does in that situation).
Discovery seems kinda hard and full of weird corner cases. It probably still has value but a few lines of "with npm/yarn/pnpm/whatever lands next week, use this in an initializer:" in the readme might help a lot.
I tried updating to node 18 (current LTS) which (at least with asdf) ships with npm 9.5.0. NPM 9 removed
npm bin
https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/.I just looked at the discovery code and realized that the yarn discovery never worked for yarn 2+ because
yarn bin
didn't return a path, but a list of executables. Therefore, npm was of course installed, so the npm lookup worked vianpm bin
because I was using node_modules with yarn.A pretty simple fix for AFAIK all yarn users, regardless of version, would be to execute
yarn bin mjml
- this should find the full path to mjml (this would be a really simple PR).Not sure what to do about npm 9+, in terms of a general solution.
For now, an initializer with this in it:
...solves the issue for me.