Php laravel, node: not found for running SSR

hassanoumar
HOBBY

2 months ago

Hello,

I using Railpack to deploy my PHP Laravel application, and its working fine.

But as a start command i have a requirement to run a node process for SSR (server side rendering) which is built by Inertia with Vuejs.

in logs I see this error

sh: 1: exec: node: not found [2025-05-18 16:34:07] production.ERROR: sh: 1: exec: node: not found {"exception":"[object] (Inertia\\Ssr\\SsrException(code: 0): sh: 1: exec: node: not found

$10 Bounty

7 Replies

hassanoumar
HOBBY

2 months ago

my start command sh

Attachments


hassanoumar
HOBBY

2 months ago

I believe the issue is in the final image that the build is producing

This is output from the build, as last steps

[railpack] merge $install:composer, $prune:node, $build

This seems to be removing node from the final build

and because my main project is PHP, its not considering node to be worth to keep it.

I added this env

RAILPACK_PRUNE_DEPS="false"

NODE_RUNTIME="true"

RAILPACK_NO_PRUNE="true"

but nothing seems to be working

Attachments


2 months ago

Heya, can you try setting RAILPACK_NODE_VERSION ?

See our railpack docs for more help: https://railpack.com/config/file


Status changed to Awaiting User Response Railway 2 months ago


hassanoumar
HOBBY

2 months ago

I set
RAILPACK_NODE_VERSION=22

same result


Status changed to Awaiting Railway Response Railway 2 months ago


hassanoumar
HOBBY

2 months ago

As a work around (after couple of days of search and trying multiple methods)

I added this script which installs and rebuild node deps in my start script

# Install Node.js from NodeSource (adjust version if needed)
echo "Installing Node.js ..."
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get update && apt-get install -y nodejs

# Install dependencies and build
echo "Installing npm dependencies ..."
npm install

echo "Building assets ..."
npm run build

This worked, but I don't like this solution

hassanoumar

As a work around (after couple of days of search and trying multiple methods)I added this script which installs and rebuild node deps in my start script# Install Node.js from NodeSource (adjust version if needed) echo "Installing Node.js ..." curl -fsSL https://deb.nodesource.com/setup_18.x | bash - apt-get update && apt-get install -y nodejs # Install dependencies and build echo "Installing npm dependencies ..." npm install echo "Building assets ..." npm run build This worked, but I don't like this solution

sim
FREETop 1% Contributor

a month ago

Oh this is to install Node and rebuild on every start? Is it being reliable for you?


sim
FREETop 1% Contributor

a month ago

Why don't you try to build a custom Docker image with PHP and Node?