Limenius / symfony-react-sandbox

Example of integration with React and Webpack (Webpack Encore) for universal (isomorphic) React rendering, using Limenius/ReactBundle and Limenius/LiformBundle
MIT License
337 stars 77 forks source link

PhpExecJs: Cannot autodetect any JavaScript runtime #45

Closed BernardA closed 6 years ago

BernardA commented 6 years ago

Hi

This is on my own project. I did not notice this on the sandbox.

I installed PhpExecJs with

brew install php71-v8js

, but whenever I set the config default_rendering for server_side rendering or both it throws the error above.

It works with client_side rendering only ( with other issues, but that's something for later ).

Are there any other steps that should be taken for it to recognize PhpExecJs? I read through the PhpExecJs's documentation on Github but could not find anything else.

I'm on Mac, by the way.

Thanks

Bernard

nacmartin commented 6 years ago

Basically if it installed and enabled, it is available and should be detected.

Phpexecjs is simply calling extension_loaded('v8js'); to check if it is installed. So, this in your case must be throwing "false".

https://github.com/nacmartin/phpexecjs/blob/master/src/Nacmartin/PhpExecJs/Runtime/V8jsRuntime.php#L43

Can you check that phpinfo(); shows that the extension is indeed enabled? sometimes you need to restart php71 in brew services for instance so extensions are enabled after installation.

BernardA commented 6 years ago

It seems that there is no V8 extension installed. I use MAMP and could not find it there. Also it does not seem to be trivial to install it on MAMP, or even in Mac as such. I still haven't found how to do it.

While I don't have v8js, I attempted to run the program setting config.yml with external_server.

Both on my project and on the sandbox I got the following error:

An exception has been thrown during the rendering of a template ("Warning: stream_socket_client(): unable to connect to unix:///Users/BAMAC/Sites/symfony-react-sandbox/app/Resources/node-server/node.sock (No such file or directory)").

Good reason for that is that the node.sock file is missing. See https://github.com/Limenius/symfony-react-sandbox/tree/master/app/Resources/node-server.

So, there' s that on that side, plus the fact you mentioned about keeping the server running, but I did not get there yet.

Thanks

BernardA commented 6 years ago

closing this as the initial issue was resolved by installing v8js. external server issue remain. Will open a separate issue

nacmartin commented 6 years ago

Thanks, @BernardA. I will have a look at the external server. Just FYI this branch ( https://github.com/Limenius/symfony-react-sandbox/tree/symfony4 ) , that should be "master" in short time, uses a new version of React Bundle that has caching support for V8js, which makes it faster in production.