Php laravel, node: not found for running SSR
hassanoumar
HOBBYOP

a year 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

8 Replies

hassanoumar
HOBBYOP

a year ago

my start command sh

Attachments


hassanoumar
HOBBYOP

a year 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


a year 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 about 1 year ago


hassanoumar
HOBBYOP

a year ago

I set

RAILPACK_NODE_VERSION=22

same result


Status changed to Awaiting Railway Response Railway about 1 year ago


hassanoumar
HOBBYOP

a year 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 ```shellscript # 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
FREE

a year ago

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


sim
FREE

a year ago

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


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 ```shellscript # 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 ```

henryo
PRO

6 months ago

Have you figured out a better solution because currently I am having the same issue. I have two services SSR for running php inertia ssr and another just the normal php app

The ssr one seems not to run at all i am guessing it is because of the node issue you mentioned above. Did you figure out to handle it better?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...