Railpack not respecting Bun version
jwaltz
PROOP

2 months ago

Service is building with older version of Bun, not respecting package.json:


scheduling build on Metal builder "builder-ffuywq"
unpacking archive
30.1 MB
126ms
using build driver railpack-v0.37.0
local://prepare-driver
0ms
local://prepare-context
0ms
uploading snapshot
17 MB
497ms
prepare railpack-v0.37.0
1s
╭─────────────────╮
│ Railpack 0.37.0 │
╰─────────────────╯
  ↳ Detected Node
  ↳ Using bun package manager
  ↳ Custom start command detected, skipping Caddy start
  ↳ Bun runtime detected
  Packages  
  ──────────
  bun   │  1.3.14   │  package.json > engines > bun (>=1.4.0)
  node  │  22.23.2  │  previous installed version (22)

This is how package.json specifies Bun version:

"engines": {
    "bun": ">=1.4.0"
  },

Mise has had support for Bun v1.4 as of 4 days ago: https://mise-tools.jdx.dev/tools/bun

Solved$20 Bounty

Pinned Solution

2 months ago

I looked into this and we actually don't support contraints in package.json > engines, unfortunately. This is mainly because mise, which we use for version resolution, doesn't support them either.

However, this is something we could definitely improve in the future! I've created an issue to track it.

In the short term, specifying a patch version in engines or devEngines should force bun 1.4 to be used.

11 Replies

Railway
BOT

2 months ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • about 2 months ago


2 months ago

Try configure the version via Service Variable

RAILPACK_BUN_VERSION=1.4


mayori

Try configure the version via Service Variable `RAILPACK_BUN_VERSION=1.4`

jwaltz
PROOP

2 months ago

Never had to do that before and would prefer not to have another env variable. Engine in package.json should support according to railpack docs? Will try anyway.


jwaltz

Never had to do that before and would prefer not to have another env variable. Engine in package.json should support according to railpack docs? Will try anyway.

2 months ago

Yeah, engine should work, how your current package.json looks like?


mayori

Yeah, engine should work, how your current `package.json` looks like?

jwaltz
PROOP

2 months ago

see OP at bottom


mayori

Yeah, engine should work, how your current `package.json` looks like?

jwaltz
PROOP

2 months ago

Removing engine in favor of env variable works. Railpack respects the env var. Perhaps its a bug that it isn't respecting engines? It doesn't work with both as engines in package.json seems to have higher priority.


jwaltz

Removing engine in favor of env variable works. Railpack respects the env var. Perhaps its a bug that it isn't respecting engines? It doesn't work with both as engines in package.json seems to have higher priority.

2 months ago

Do you have packageManager field in your package.json?


mayori

Do you have `packageManager` field in your `package.json`?

jwaltz
PROOP

2 months ago

No


2 months ago

Hey! Just set it on the packageManager field, I just deployed a Bun 1.4 app using Railpack.

"packageManager": "bun@1.4.0",


jwaltz
PROOP

2 months ago

The packageManager field only accepts specific versions. The engines field accepted >= semver range syntax. I'd like to see engines working again if possible


jwaltz

The `packageManager` field only accepts specific versions. The `engines` field accepted `>=` semver range syntax. I'd like to see `engines` working again if possible

2 months ago

I recommend switching to a Dockerfile.


2 months ago

I looked into this and we actually don't support contraints in package.json > engines, unfortunately. This is mainly because mise, which we use for version resolution, doesn't support them either.

However, this is something we could definitely improve in the future! I've created an issue to track it.

In the short term, specifying a patch version in engines or devEngines should force bun 1.4 to be used.


Status changed to Solved medim • 12 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...