Rails app `fly deploy` failing with ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime

I had the same problem.

I solved by adding this to the dockerfile, and making sure I added it just before the line containing fly:build (adding it earlier in the Dockerfile produced the same error).

RUN apt-get update
RUN apt-get install nodejs -y

Hope it helps.