a month ago
I’m seeing inconsistent environment behaviour between railway ssh and railway ssh --session
Railway CLI: 4.40.0
railway ssh
✓ Connected to interactive shell root@bd024a39ad51:/app# node Welcome to Node.js v22.22.2.
Type ".help" for more information.
>
(To exit, press Ctrl+C again or Ctrl+D or type .exit) > root@bd024a39ad51:/app# echo $PATH /app/node_modules/.bin:/app/node_modules/.bin:/mise/shims:/mise/shims:/mise/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binrailway ssh --session
root@bd024a39ad51:/app# node
-bash: node: command not found
root@bd024a39ad51:/app# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binI have tried adding a preDeployCommand to symlink the mise shims to a location that is in PATH, but that doesn't work eitherln -sf /mise/shims/* /usr/local/bin/
What is the recommended way to place npm and node in PATH when using the Tmux session?
2 Replies
a month ago
The --session flag starts a tmux process which spawns a new login shell that does not inherit the environment variables (including the modified PATH with /mise/shims) that railway ssh injects into the direct interactive session. This is a known behavioral difference where tmux resets the shell environment. As a workaround, you can source the PATH in your shell profile by adding export PATH="/mise/shims:/app/node_modules/.bin:$PATH" to /root/.bashrc in your Dockerfile so that tmux's login shell picks it up.
Status changed to Awaiting User Response Railway • about 1 month ago
Status changed to Awaiting Railway Response Railway • about 1 month ago
Railway
The `--session` flag starts a tmux process which spawns a new login shell that does not inherit the environment variables (including the modified PATH with `/mise/shims`) that `railway ssh` injects into the direct interactive session. This is a known behavioral difference where tmux resets the shell environment. As a workaround, you can source the PATH in your shell profile by adding `export PATH="/mise/shims:/app/node_modules/.bin:$PATH"` to `/root/.bashrc` in your Dockerfile so that tmux's login shell picks it up.
a month ago
I am using Railpack not Dockerfile. If this is "a known behavioral difference" then why is it not documented?
Status changed to Open Railway • about 1 month ago