Cannot Deploy my rails app

=> ERROR [build 6/6] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile 0.3s

[build 6/6] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile:
#16 0.257 ./bin/rails: 4: Syntax error: “(” unexpected

Error: failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile]: exit code: 2

It looks to me like there might be a syntax error in one of the JavaScript configuration files that are used by the asset pipeline.

Which version of Rails are you using? And which version of the asset pipeline (sprockets, webpacker, shakapacker, esbuild, something else)?

Try to run the following command locally to debug this further:

RAILS_ENV=production SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile

RAILS_ENV=production SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile
./bin/rails: line 4: syntax error near unexpected token (' ./bin/rails: line 4: APP_PATH = File.expand_path(“…/config/application”, dir)’

is what i get when running that command you asked me to run.

I run webpacker, I haven’t done any JavaScript config

Im using rails 7 and

Webpacker itself comes with some configuration files (see the .js files in ./config/webpack/ and also ./config/webpack.yml)

But I think you might be hitting this problem: ruby on rails - syntax error near unexpected token `(' - Stack Overflow. Maybe you can try the fix mentioned there and see if that resolves the issue?

1 Like

you sir are a god damn life saver thank you so much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.