How to use capistrano to deploy a Rails app with bun for js?

76 Views Asked by At

Title says it all. I have an app that's been using esbuild to this point without issues, and I can successfully run bun in development with no problems.

I've logged in to my Ubuntu 20.04 server as the deploy user and installed bun with:

curl -fsSL https://bun.sh/install | bash 

I can then run bun successfully:

$ bun -v
# => 1.0.13

But the capistrano deploy fails with:

cssbundling-rails: Command install failed, ensure bun is installed

What am I missing here?

1

There are 1 best solutions below

0
croceldon On

The issue here is that the bun installer adds lines to the user's .bashrc that puts the bun bin (type that three times fast...) on the user's path. But the majority of the .bashrc doesn't run in the non-interactive capistrano login.

The solution is to add this in the config/deploy.rb:

set :default_env, { path: "~/.bun/bin:$PATH" }