You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I have a bug where the exact same code always works when running my app on MacOS and Linux machines, but I get a NodeJS JSON parse error on Windows environments.
My code is as follows:
in the content function of a Laravel mailable, I generate MJML like this:
The toHtml() function works fine and renders HTML that can be used perfectly in emails, on Mac.
But on Windows, I get the following error:
The command ""C:\Program Files\nodejs\\node.EXE" mjml.mjs "[""<mjml>\r\n <mj-head>\r\n <mj-title>Test<\/mj-title>\r\n <mj-raw>\r\n <meta name=\""color-scheme\"" content=\""light dark\"">\r\n <meta name=\""supported-color-schemes\"" content=\""light dark\"">\r\n <link rel=\""preconnect\"" href=\""https:\/\/fonts.googleapis.com\"">\r\n <link rel=\""preconnect\"" href=\""https:\/\/fonts.gstatic.com\"" crossorigin>\r\n <\/mj-raw>\r\n\r\n <mj-font name=\""Montserrat\""
.......
<\/mj-body>\r\n<\/mjml>"",{""keepComments"":true,""ignoreIncludes"":false,""beautify"":false,""minify"":false,""validationLevel"":""strict"",""filePath"":"".""}]"" failed. Exit Code: 1(General error) Working directory: C:\Projects\shop\vendor\spatie\mjml-php\bin Output: ================ Error Output: ================ undefined:1 SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at file:///C:/Projects/shop/vendor/spatie/mjml-php/bin/mjml.mjs:3:19 at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:385:24) at async loadESM (node:internal/process/esm_loader:88:5) at async handleMainPromise (node:internal/modules/run_main:61:12)
I tried a lot of things, like minifying, trimming characters, shortening the mjml code, etc etc., but nothing works.
The issue is also not with my node environment setup, because if I enter the code as input from the readme of the package then the toHtml() function does work and render the email correctly.:
This discussion was converted from issue #13 on January 02, 2024 13:14.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What happened?
Currently I have a bug where the exact same code always works when running my app on MacOS and Linux machines, but I get a NodeJS JSON parse error on Windows environments.
My code is as follows:
in the content function of a Laravel mailable, I generate MJML like this:
the mail template looks like this basically:
The toHtml() function works fine and renders HTML that can be used perfectly in emails, on Mac.
But on Windows, I get the following error:
I tried a lot of things, like minifying, trimming characters, shortening the mjml code, etc etc., but nothing works.
The issue is also not with my node environment setup, because if I enter the code as input from the readme of the package then the toHtml() function does work and render the email correctly.:
The above works on my machine.
The issue seems to be with the rendered blade view content. But this sequence does work without issue on Mac.
What could be the problem here?
How to reproduce the bug
Try to convert pre-rendered mjml from a blade view to Html on a Windows environment.
Package Version
1.0.2
PHP Version
8.2.0
Which operating systems does with happen with?
Windows
Notes
No response
Beta Was this translation helpful? Give feedback.
All reactions