Error in Rails initial complie - SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile

ERROR [build 9/9] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile 1.7s

[build 9/9] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile:
#24 1.669 rails aborted!
#24 1.669 LoadError: cannot load such file – ox/ox
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:324:in block in require’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:291:in load_dependency' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:324:in require’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/ox-2.14.11/lib/ox.rb:79:in <main>' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:324:in block in require' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:291:in load_dependency’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:324:in require' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/correios-cep-0.8.0/lib/correios/cep/parser.rb:2:in
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:324:in block in require’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:291:in load_dependency' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.6/lib/active_support/dependencies.rb:324:in require’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/correios-cep-0.8.0/lib/correios-cep.rb:5:in <main>' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require’
#24 1.669 /usr/local/bundle/gems/bundler-2.4.17/lib/bundler/runtime.rb:60:in block (2 levels) in require' #24 1.669 /usr/local/bundle/gems/bundler-2.4.17/lib/bundler/runtime.rb:55:in each’
#24 1.669 /usr/local/bundle/gems/bundler-2.4.17/lib/bundler/runtime.rb:55:in block in require' #24 1.669 /usr/local/bundle/gems/bundler-2.4.17/lib/bundler/runtime.rb:44:in each’
#24 1.669 /usr/local/bundle/gems/bundler-2.4.17/lib/bundler/runtime.rb:44:in require' #24 1.669 /usr/local/bundle/gems/bundler-2.4.17/lib/bundler.rb:187:in require’
#24 1.669 /rails/config/application.rb:7:in <main>' #24 1.669 /rails/Rakefile:4:in require_relative’
#24 1.669 /rails/Rakefile:4:in <main>' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6/lib/rails/commands/rake/rake_command.rb:22:in block in perform’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6/lib/rails/commands/rake/rake_command.rb:20:in perform' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6/lib/rails/command.rb:48:in invoke’
#24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/railties-6.0.6/lib/rails/commands.rb:18:in <main>' #24 1.669 /rails/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require’
#24 1.669 ./bin/rails:9:in `’
#24 1.669 (See full trace by running task with --trace)


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

What version of ox are you using? Ruby 2.7.6 LoadError: cannot load such file -- ox/ox - Stack Overflow seems to match your problem, and mentions a fix: Load C extension with require_relative by hsbt · Pull Request #301 · ohler55/ox · GitHub that may have been included in the 2.14.12 release.

Hello Rubys, thanks for the help.

in my gemfile.lock ox in the version:

correios-cep (0.8.0)
http (~> 4.3)
ox (~> 2.13)
ox (2.14.11)

I’ve run a test and it does indeed fail with 2.14.11 and succeeds with 2.14.12.

Hi Rubys, this solution worked, but I have another error:

=> ERROR [build 13/13] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompil 9.0s

[build 13/13] RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile:
#28 2.580 yarn install v1.22.19
#28 2.659 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
#28 2.664 [1/5] Validating package.json…
#28 2.668 [2/5] Resolving packages…
#28 3.172 [3/5] Fetching packages…
#28 3.719 [4/5] Linking dependencies…
#28 3.720 warning " > @babel/plugin-proposal-private-methods@7.18.6" has unmet peer dependency “@babel/core@^7.0.0-0”.
#28 3.720 warning “@babel/plugin-proposal-private-methods > @babel/helper-create-class-features-plugin@7.22.9” has unmet peer dependency “@babel/core@^7.0.0”.
#28 3.721 warning “@babel/plugin-proposal-private-methods > @babel/helper-create-class-features-plugin > @babel/helper-replace-supers@7.22.9” has unmet peer dependency “@babel/core@^7.0.0”.
#28 3.724 warning “@babel/plugin-proposal-private-property-in-object > @babel/plugin-syntax-private-property-in-object@7.14.5” has unmet peer dependency “@babel/core@^7.0.0-0”.
#28 3.727 warning " > @babel/plugin-proposal-private-property-in-object@7.21.11" has unmet peer dependency “@babel/core@^7.0.0-0”.
#28 5.799 [5/5] Building fresh packages…
#28 5.821 Done in 3.25s.
#28 6.124 I, [2023-07-26T18:56:21.610867 #8] INFO – : Writing /rails/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
#28 6.124 I, [2023-07-26T18:56:21.611399 #8] INFO – : Writing /rails/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
#28 6.125 I, [2023-07-26T18:56:21.612122 #8] INFO – : Writing /rails/public/assets/application-f51678a7d412574f9c63627b0802a9517c909259bad3d1dc2d03d3a1fc35632a.css
#28 6.126 I, [2023-07-26T18:56:21.612972 #8] INFO – : Writing /rails/public/assets/application-f51678a7d412574f9c63627b0802a9517c909259bad3d1dc2d03d3a1fc35632a.css.gz
#28 6.126 I, [2023-07-26T18:56:21.613354 #8] INFO – : Writing /rails/public/assets/jquery-ui/ui-icons_444444_256x240-f6d8c091e81dfb911fc0815e7c9952c90b361a3f685804be08a5fa2ee6d6198b.png
#28 6.128 I, [2023-07-26T18:56:21.615224 #8] INFO – : Writing /rails/public/assets/jquery-ui/ui-icons_555555_256x240-c23f23416a84a359723ffe28c6231f7e6edd10de024da40c190f9e0706c70276.png
#28 6.128 I, [2023-07-26T18:56:21.615533 #8] INFO – : Writing /rails/public/assets/jquery-ui/ui-icons_ffffff_256x240-24221a00d39ccfd2da654907e99b5af8d8dc60b91bfb414b4ca82779f7f9ffb6.png
#28 6.128 I, [2023-07-26T18:56:21.615863 #8] INFO – : Writing /rails/public/assets/jquery-ui/ui-icons_777620_256x240-0a3bb6e0c499ea585572cbda26b638d08b96a568bfb173f0dce2c9eee4a441b3.png
#28 6.130 I, [2023-07-26T18:56:21.617437 #8] INFO – : Writing /rails/public/assets/jquery-ui/ui-icons_cc0000_256x240-c7cf3a680d1476856186d49a361c0b3e09d13a2f4ba4ebd638595bbad9d21c2d.png
#28 6.131 I, [2023-07-26T18:56:21.618120 #8] INFO – : Writing /rails/public/assets/jquery-ui/ui-icons_777777_256x240-ea4f5d5317b31eaaaf01e3db3357884b418c8b3361019647559c835996ddaedb.png
#28 6.131 I, [2023-07-26T18:56:21.618610 #8] INFO – : Writing /rails/public/assets/contatos-dc84db8ff6f72b9508a10e39316b9197949e855df94792587b1253235c7d277b.css
#28 6.132 I, [2023-07-26T18:56:21.618997 #8] INFO – : Writing /rails/public/assets/contatos-dc84db8ff6f72b9508a10e39316b9197949e855df94792587b1253235c7d277b.css.gz
#28 6.132 I, [2023-07-26T18:56:21.619539 #8] INFO – : Writing /rails/public/assets/documentacao-411631fa6ed448f23ba964f15755b6893c2964f620e7b71b16ec2be36120cd91.css
#28 6.133 I, [2023-07-26T18:56:21.619935 #8] INFO – : Writing /rails/public/assets/documentacao-411631fa6ed448f23ba964f15755b6893c2964f620e7b71b16ec2be36120cd91.css.gz
#28 6.133 I, [2023-07-26T18:56:21.620679 #8] INFO – : Writing /rails/public/assets/empresas-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.134 I, [2023-07-26T18:56:21.620972 #8] INFO – : Writing /rails/public/assets/empresas-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.134 I, [2023-07-26T18:56:21.621419 #8] INFO – : Writing /rails/public/assets/forma_pagamento-205bc89bc03f5ad38e91f01f7c404ab72a5193600526e75b6cab7f762de3f531.css
#28 6.134 I, [2023-07-26T18:56:21.621625 #8] INFO – : Writing /rails/public/assets/forma_pagamento-205bc89bc03f5ad38e91f01f7c404ab72a5193600526e75b6cab7f762de3f531.css.gz
#28 6.134 I, [2023-07-26T18:56:21.621882 #8] INFO – : Writing /rails/public/assets/global-620d7b2d8d436231067a5946e855420599dcbd74b508dd0156a994a2faf8c092.css
#28 6.135 I, [2023-07-26T18:56:21.622104 #8] INFO – : Writing /rails/public/assets/global-620d7b2d8d436231067a5946e855420599dcbd74b508dd0156a994a2faf8c092.css.gz
#28 6.135 I, [2023-07-26T18:56:21.622340 #8] INFO – : Writing /rails/public/assets/home-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.135 I, [2023-07-26T18:56:21.622579 #8] INFO – : Writing /rails/public/assets/home-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.135 I, [2023-07-26T18:56:21.622812 #8] INFO – : Writing /rails/public/assets/index-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.136 I, [2023-07-26T18:56:21.623032 #8] INFO – : Writing /rails/public/assets/index-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.136 I, [2023-07-26T18:56:21.623286 #8] INFO – : Writing /rails/public/assets/info_nota_fiscal-01abdf2af4150c14760fa32dda22ea7ad07c319888847b35e047ba08f03e8c91.css
#28 6.136 I, [2023-07-26T18:56:21.623519 #8] INFO – : Writing /rails/public/assets/info_nota_fiscal-01abdf2af4150c14760fa32dda22ea7ad07c319888847b35e047ba08f03e8c91.css.gz
#28 6.136 I, [2023-07-26T18:56:21.623754 #8] INFO – : Writing /rails/public/assets/pdfs-f614dc20c448016bd50c0c8186dd7e1af12aa40a24671f260df1537ddc39df35.css
#28 6.137 I, [2023-07-26T18:56:21.624185 #8] INFO – : Writing /rails/public/assets/pdfs-f614dc20c448016bd50c0c8186dd7e1af12aa40a24671f260df1537ddc39df35.css.gz
#28 6.140 I, [2023-07-26T18:56:21.626949 #8] INFO – : Writing /rails/public/assets/produto_vendas-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.140 I, [2023-07-26T18:56:21.627217 #8] INFO – : Writing /rails/public/assets/produto_vendas-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.140 I, [2023-07-26T18:56:21.627416 #8] INFO – : Writing /rails/public/assets/produtos-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.140 I, [2023-07-26T18:56:21.627514 #8] INFO – : Writing /rails/public/assets/produtos-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.140 I, [2023-07-26T18:56:21.627628 #8] INFO – : Writing /rails/public/assets/relatorio-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.141 I, [2023-07-26T18:56:21.628404 #8] INFO – : Writing /rails/public/assets/relatorio-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.142 I, [2023-07-26T18:56:21.629846 #8] INFO – : Writing /rails/public/assets/services-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.143 I, [2023-07-26T18:56:21.630000 #8] INFO – : Writing /rails/public/assets/services-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.143 I, [2023-07-26T18:56:21.630298 #8] INFO – : Writing /rails/public/assets/toggle-bc79e72349fee36fa8ae0f2f7152319b928074205741e495320afb3ce16befe9.css
#28 6.143 I, [2023-07-26T18:56:21.630694 #8] INFO – : Writing /rails/public/assets/toggle-bc79e72349fee36fa8ae0f2f7152319b928074205741e495320afb3ce16befe9.css.gz
#28 6.144 I, [2023-07-26T18:56:21.631127 #8] INFO – : Writing /rails/public/assets/usuario_perfis-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.145 I, [2023-07-26T18:56:21.631757 #8] INFO – : Writing /rails/public/assets/usuario_perfis-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.145 I, [2023-07-26T18:56:21.632369 #8] INFO – : Writing /rails/public/assets/usuarios-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#28 6.145 I, [2023-07-26T18:56:21.632542 #8] INFO – : Writing /rails/public/assets/usuarios-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#28 6.498 Compiling…
#28 8.773 Compilation failed:
#28 8.773 node:internal/process/promises:279
#28 8.773 triggerUncaughtException(err, true /* fromPromise */);
#28 8.773 ^
#28 8.773
#28 8.773 Error: Cannot find package ‘@babel/plugin-proposal-private-property-in-object’ imported from /rails/babel-virtual-resolve-base.js
#28 8.773 at new NodeError (/rails/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:203:5)
#28 8.773 at packageResolve (/rails/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:873:9)
#28 8.773 at moduleResolve (/rails/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:902:20)
#28 8.773 at defaultResolve (/rails/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:985:15)
#28 8.773 at resolve (/rails/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:999:12)
#28 8.773 at resolve (/rails/node_modules/@babel/core/lib/config/files/import-meta-resolve.js:13:10)
#28 8.773 at tryImportMetaResolve (/rails/node_modules/@babel/core/lib/config/files/plugins.js:137:45)
#28 8.773 at resolveStandardizedNameForImport (/rails/node_modules/@babel/core/lib/config/files/plugins.js:159:19)
#28 8.773 at resolveStandardizedName (/rails/node_modules/@babel/core/lib/config/files/plugins.js:168:12)
#28 8.773 at loadPlugin (/rails/node_modules/@babel/core/lib/config/files/plugins.js:47:20)
#28 8.773 at loadPlugin.next ()
#28 8.773 at createDescriptor (/rails/node_modules/@babel/core/lib/config/config-descriptors.js:139:16)
#28 8.773 at createDescriptor.next ()
#28 8.773 at step (/rails/node_modules/gensync/index.js:261:32)
#28 8.773 at evaluateAsync (/rails/node_modules/gensync/index.js:291:5)
#28 8.773 at /rails/node_modules/gensync/index.js:44:11
#28 8.773 at Array.forEach ()
#28 8.773 at Function.async (/rails/node_modules/gensync/index.js:43:15)
#28 8.773 at Function.all (/rails/node_modules/gensync/index.js:216:13)
#28 8.773 at Generator.next ()
#28 8.773 at createDescriptors (/rails/node_modules/@babel/core/lib/config/config-descriptors.js:101:41)
#28 8.773 at createDescriptors.next ()
#28 8.773 at createPluginDescriptors (/rails/node_modules/@babel/core/lib/config/config-descriptors.js:98:17)
#28 8.773 at createPluginDescriptors.next ()
#28 8.773 at /rails/node_modules/@babel/core/lib/gensync-utils/functional.js:21:23
#28 8.773 at Generator.next ()
#28 8.773 at mergeChainOpts (/rails/node_modules/@babel/core/lib/config/config-chain.js:347:34)
#28 8.773 at mergeChainOpts.next ()
#28 8.773 at chainWalker (/rails/node_modules/@babel/core/lib/config/config-chain.js:314:14)
#28 8.773 at chainWalker.next ()
#28 8.773 at loadFileChain (/rails/node_modules/@babel/core/lib/config/config-chain.js:192:24)
#28 8.773 at loadFileChain.next ()
#28 8.773 at buildRootChain (/rails/node_modules/@babel/core/lib/config/config-chain.js:78:27)
#28 8.773 at buildRootChain.next ()
#28 8.773 at loadPrivatePartialConfig (/rails/node_modules/@babel/core/lib/config/partial.js:79:62)
#28 8.773 at loadPrivatePartialConfig.next () {
#28 8.773 code: ‘ERR_MODULE_NOT_FOUND’
#28 8.773 }
#28 8.773


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

It looks like you have mixed npm and yarn calls, got warning about unmet dependencies for babel, and ultimately an error related to not being about to find a babel package. Probably the best thing to do right now is:

  • Delete package-lock.json and the entire node_modules directory.
  • Run yarn install

After you complete that, you should be able to deploy.

Thanks for the help Rubys,

I changed the environment in the DockerFile to development and the deploy worked correctly

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