Search code examples
phpnode.jslaravelweb-scrapinglaravel-livewire

Node not found on laravel project


i've been trying to use a package called PuPHPeteer but i have a problem:

It seems like the package requires node to be used. https://github.com/zoonru/puphpeteer this is the package link. I installed it using the 2 commands posted on the page:

composer require zoon/puphpeteer
npm install github:zoonru/puphpeteer

I copied some of the code from the github page to test if it works:

 $puppeteer = new Puppeteer; ---> exception here
 $browser = $puppeteer->launch();
 $page = $browser->newPage();

But after i get to the first line of the code during execution i get this error:

The command "node "C:\Users\Fran\Documents\GitHub\precios-project\app\vendor\zoon\rialto\src/node-process/serve.js" C:\Users\Fran\Documents\GitHub\precios-project\app\vendor\zoon\puphpeteer\src\PuppeteerConnectionDelegate.js "{""idle_timeout"":60,""log_node_console"":false,""log_browser_console"":false,""js_extra"":""""}"" failed. Exit Code: 1(General error) Working directory: C:\Users\Fran\Documents\GitHub\precios-project\app\public Output: ================ Error Output: ================ "node" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.

Its in spanish because i use that lenguage in my computer but i think it is a typical "Node its not recognized error"

"node" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.* means "The term node is not recognized as the name of a cmdlet, function, script file, or operable program" i think.

Error capture

i only found solutions that talk about the path enviroment variable not being set correctly but i think mine is good.

Capture of my path variable

Any ideas??

Tried to run PuPHPeteer in a laravel project.

Expected it to work.

Resulted in a node error.


Solution

  • After changing to Linux I no longer encountered the issue and it worked perfectly. It seems as if it was a problem setting up the development environment in Windows.