-
Notifications
You must be signed in to change notification settings - Fork 9
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
Unable to compile MJML with BinaryRenderer #10
Comments
Hi! It looks like
Sometimes you need to do a symlink: https://stackoverflow.com/a/26320915 |
Thank you for this quick answer. Node is installed,
I've tried I'm sorry, if it's 100% node related let's close this thread. |
Alright. Keep me informed, I'll reopen if necessary. |
Same issue here. Do you remember how you solved this? |
Nope, I'm using their API.
… Le 12 juil. 2022 à 15:13, Sjoerd Boerrigter ***@***.***> a écrit :
Same issue here. Do you remember how you solved this?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Ok, thanks for your quick reply. Unfortunately the API is no option for me because it uses an outdated version of MJML that has trouble rendering responsive e-mails in Outlook (mjmlio/mjml#2434). @qferr maybe this issue should be reopened? |
@sboerrigter Let me know the error message please. |
I have the same error as above:
I tested this on my local development environment (MacOS with Laravel Valet, Nginx, PHP 8.0) and the production server (Linux, Apache, PHP 8.0). They both give the same error. Also if I try to render some very basic markup like this:
I hope this helps. Just let me know if there is anything I can do to help! |
Are you sure |
That works:
|
Can you try |
|
I ran unit tests and a PHP test file with the example from the README.md, I can't reproduce the problem. Did you try to run a PHP file test with the example? |
Can you drop the result of |
|
I think Could you add a symlink Source : nvm-sh/nvm#786 |
I cannot add a symlink to
I can add it to I am not using NVM on my production server which has the same problem. |
Are there any updates on this or is there anything else I can do to help? Thanks in advance. |
Hello. I can't reproduce the problem. I think your infrastructure is the cause. The automated tests passed and I tested this on my local development and it works well. |
If you still have the problem, please reopen the issue. |
Hi there, I struggled all day with the exact same issue. Using the command from a terminal worked like a charm but I got the same error when running the command from the server. This answer on StackOverflow finally got me to the solution. When running the command through Laravel you may have to set the path where Node is installed as an environment var. In my case it was Here is a simple wrapper that takes an MJML file as argument and renders the HTML: <?php
namespace App\Support;
use Illuminate\Support\Facades\Process;
class Mjml
{
/**
* Render HTML from an MJML file.
*/
public static function render(string $path): string
{
$env = [];
if (config('settings.node_path')) {
$env['PATH'] = '$PATH:'.config('settings.node_path');
}
$result = Process::path(base_path())
->env($env)
->run("node_modules/.bin/mjml {$path} -s")
->throw();
return $result->output();
}
} Here is my <?php
return [
// ...
'node_path' => env('NODE_PATH', null),
]; Finally you can set the Node path in your
Maybe this plugin could include an option to set this value? |
Hi !
I'm trying to use this library, but I'm getting a Fatal error :
Fatal error: Uncaught RuntimeException: Unable to compile MJML. Stack error: The command "'/Users/maiis/Sites/mjml/node_modules/.bin/mjml' '-i' '-s' '--config.validationLevel' '--config.minify'" failed. Exit Code: 127(Command not found) Working directory: /Users/maiis/Sites/mjml/wp-content/themes/client Output: ================ Error Output: ================ env: node: No such file or directory in /Users/maiis/Sites/mjml/wp-content/themes/client/inc/commun/emails/lib/mjml/vendor/qferr/mjml-php/src/Mjml/Renderer/BinaryRenderer.php:49 Stack trace: #0 /Users/maiis/Sites/mjml/wp-content/themes/client/index.php(16): Qferrer\Mjml\Renderer\BinaryRenderer->render('<mjml>\n\t<mj-hea...') #1 /Users/maiis/Sites/mjml/wp-includes/template-loader.php(106): include('/Users/maiis/Si...') #2 /Users/maiis/Sites/mjml/wp-blog-header.php(19): require_once('/Users/maiis/Si...') #3 /Users/maiis/Sites/atelierd in /Users/maiis/Sites/mjml/wp-content/themes/client/inc/commun/emails/lib/mjml/vendor/qferr/mjml-php/src/Mjml/Renderer/BinaryRenderer.php on line 49
When I run from the CLI
node_modules/.bin/mjml test-std.mjml -o output.html
it works, when I use the ApiRenderer it works too.Any ideas why the command can't run ?
Thanks.
The text was updated successfully, but these errors were encountered: