Skip to content
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

Fatal error, the system cannot find the path specified #20

Closed
z1090 opened this issue Apr 13, 2022 · 6 comments
Closed

Fatal error, the system cannot find the path specified #20

z1090 opened this issue Apr 13, 2022 · 6 comments

Comments

@z1090
Copy link

z1090 commented Apr 13, 2022

Hi, I've just set up a new test project and am getting this error message:

Fatal error: Uncaught Qferrer\Mjml\Exception\ProcessException: The system cannot find the path specified. in C:\Users\user\email_test\vendor\qferr\mjml-php\src\Process\Process.php:42 Stack trace: #0 C:\Users\user\email_test\vendor\qferr\mjml-php\src\Renderer\BinaryRenderer.php(42): Qferrer\Mjml\Process\Process->run() #1 C:\Users\user\email_test\app\App.php(14): Qferrer\Mjml\Renderer\BinaryRenderer->render('\r\n \r\n ...') #2 C:\Users\user\email_test\bootstrap.php(9): App\App->start() #3 C:\Users\user\email_test\public\index.php(6): require_once('C:\Users\z1090\...') #4 {main} thrown in C:\Users\user\email_test\vendor\qferr\mjml-php\src\Process\Process.php on line 42

Any ideas on how to fix this?

My file structure currently looks like this:

index.php

<?php
	declare(strict_types=1);

	namespace App;

	require_once(dirname(__DIR__) . '/bootstrap.php');

bootstrap.php

<?php
	declare(strict_types=1);

	namespace App;

	require_once __DIR__ . "/vendor/autoload.php";

	$App = new App();
	$App->start();

App.php

<?php
	declare(strict_types=1);

	namespace App;

	use Qferrer\Mjml\Renderer\BinaryRenderer;

	class App
	{
		public function start(): void
		{
			$renderer = new BinaryRenderer(__DIR__ . '/node_modules/.bin/mjml');

			$html = $renderer->render('
    <mjml>
        <mj-body>
            <mj-section>
                <mj-column>
                    <mj-text>Hello world</mj-text>
                </mj-column>
            </mj-section>
        </mj-body>
    </mjml>
');
			echo $html;
		}
	}

@qferr
Copy link
Owner

qferr commented Apr 13, 2022

Hello. Could you share the project structure please? Have you installed the javascript packages? You should have the node_modules directory in the project directory.

@z1090
Copy link
Author

z1090 commented Apr 13, 2022

Hi, here's the project structure, and the contents of a few more files:

app/
  App.php
node_modules/
  [...various node modules]
public/
  .htaccess
  index.php
vendor/
  [...various vendor files]
.htaccess
bootstrap.php
composer.json
composer.lock
package.json
package-lock.json

.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ public/ [L]
    RewriteRule (.*) public/$1 [L]
</IfModule>

php_flag display_errors 1

public/.htaccess

<IfModule mod_rewrite.c>
    Options -Multiviews
    RewriteEngine On
    RewriteBase /public
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

composer.json

{
    "name": "user/email_test",
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        }
    },
    "require": {
        "qferr/mjml-php": "^2.0"
    }
}

pacakge.json

{
  "name": "test_2",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "mjml": "^4.12.0"
  }
}

Also, if it helps I'm running npm v8.6.0, node v16.11.1, composer v2.3.4, PHP v7.4.

Thanks

@qferr
Copy link
Owner

qferr commented Apr 13, 2022

The binary path is wrong. Could you try this:

$renderer = new BinaryRenderer(__DIR__ . '/../node_modules/.bin/mjml');

@z1090
Copy link
Author

z1090 commented Apr 13, 2022

I should also say I quickly tried it last week too, before you pushed V2, and I was getting the same error with the previous version.

@z1090
Copy link
Author

z1090 commented Apr 13, 2022

The binary path is wrong. Could you try this:

$renderer = new BinaryRenderer(__DIR__ . '/../node_modules/.bin/mjml');

Ah, yes, that's working now. Sorry, that was quite a simple mistake 😅 Thanks for your help!

@qferr
Copy link
Owner

qferr commented Apr 13, 2022

You're welcome! Have a good day.

@qferr qferr closed this as completed Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants