Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Linda Maya's avatar

Cannot find module '@nesk/rialto'

Hello, I am sure I have missed something about it, but I can't find it how? So I have decided to post it here.

I have installed, puphpeteer and rialto to my project file, as it is described. Then I have used the typical example without changing in my controller file.


use Nesk\Puphpeteer\Puppeteer;

class myclass extends Controller
{
    public function dofunction()
    {
$puppeteer = new Puppeteer();
        $browser = $puppeteer->launch();
        $page = $browser->newPage();
        $page->goto('https://example.com');
        $page->screenshot(['path' => 'example.png']);
        $browser->close();
}
}

It was said in rialto documents, I had to do two things. One is this class below, so I have put it in the same controller file with the above function.

use Nesk\Rialto\AbstractEntryPoint;

class FileSystem extends AbstractEntryPoint
{
    public function __construct()
    {
        parent::__construct(__DIR__.'/FileSystemConnectionDelegate.js');
        
    }
}

Then I have created FileSystemConnectionDelegate.js file and put it in the same namespace where my controllers are. The content of FileSystemConnectionDelegate.js is so:

const fs = require('fs'),
    {ConnectionDelegate} = require('@nesk/rialto');

module.exports = class FileSystemConnectionDelegate extends ConnectionDelegate
{
    handleInstruction(instruction, responseHandler, errorHandler)
    {
        // Define on which resource the instruction should be applied by default,
        // here we want to apply them on the "fs" module.
        instruction.setDefaultResource(fs);

        let value = null;

        try {
            // Try to execute the instruction
            value = instruction.execute();
        } catch (error) {
            // If the instruction fails and the user asked to catch errors (see the `tryCatch` property in the API),
            // send it with the error handler.
            if (instruction.shouldCatchErrors()) {
                return errorHandler(error);
            }

            throw error;
        }

        // Send back the value returned by the instruction
        responseHandler(value);
    }
}

At first the Node was not recognised therefore, I had to change 'executable_path' => 'c:\Nodejs\node.exe' and it seems alright.

However now, I am getting the error below error:

Nesk\Rialto\Exceptions\Node\FatalException
Cannot find module '@nesk/rialto' Require stack: - C:\Users\user\Desktop\project-v1\vendor\nesk\puphpeteer\src\PuppeteerConnectionDelegate.js - C:\Users\user\Desktop\project-v1\vendor\nesk\rialto\src\node-process\serve.js

Throwing from this file: C:\Users\user\Desktop\project-v1\vendor\nesk\rialto\src\ProcessSupervisor.php:307

It says it cannot find module '@nesk/rialto' . and I thought I have installed the rialto package with

composer require nesk/rialto npm install @nesk/rialto

I can't solve this problem. Is there something missing on my side?

0 likes
3 replies
Linda Maya's avatar

It is interesting because I have done npm install @nesk/rialto again. It updated and audited in its own way. After that, when I run the code, I am getting the below error now.

Nesk\Rialto\Exceptions\Node\FatalException
listen UNKNOWN: unknown error 0.0.0.0

the last file is: C:\Users\user\Desktop\project-v1\vendor\nesk\rialto\src\ProcessSupervisor.php:307

neilstee's avatar

I'm not familiar with the library you are using but maybe it's worth a shot if you install it from a fresh install of Laravel before installing it to your project?

Then if everything works fine on a fresh Laravel, maybe you want to try again on your project from scratch (removing vendor and node_modules folder) and run composer install and npm install && npm run dev

Please or to participate in this conversation.