Encountered a weird error while trying to push the rails app to Heroku:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.16
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.0.1
remote: -----> Installing dependencies using bundler 2.2.16
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: /tmp/build_ae8e646d/bin/bundle:42:in `gemfile': undefined method `present?' for "/tmp/build_ae8e646d/Gemfile":String (NoMethodError)
remote: Did you mean? prepend
remote: from /tmp/build_ae8e646d/bin/bundle:49:in `lockfile'
remote: from /tmp/build_ae8e646d/bin/bundle:57:in `lockfile_version'
remote: from /tmp/build_ae8e646d/bin/bundle:68:in `bundler_version'
remote: from /tmp/build_ae8e646d/bin/bundle:72:in `bundler_requirement'
remote: from /tmp/build_ae8e646d/bin/bundle:100:in `activate_bundler'
remote: from /tmp/build_ae8e646d/bin/bundle:88:in `load_bundler!'
remote: from /tmp/build_ae8e646d/bin/bundle:116:in `<main>'
remote: Bundler Output: /tmp/build_ae8e646d/bin/bundle:42:in `gemfile': undefined method `present?' for "/tmp/build_ae8e646d/Gemfile":String (NoMethodError)
remote: Did you mean? prepend
remote: from /tmp/build_ae8e646d/bin/bundle:49:in `lockfile'
remote: from /tmp/build_ae8e646d/bin/bundle:57:in `lockfile_version'
remote: from /tmp/build_ae8e646d/bin/bundle:68:in `bundler_version'
remote: from /tmp/build_ae8e646d/bin/bundle:72:in `bundler_requirement'
remote: from /tmp/build_ae8e646d/bin/bundle:100:in `activate_bundler'
remote: from /tmp/build_ae8e646d/bin/bundle:88:in `load_bundler!'
remote: from /tmp/build_ae8e646d/bin/bundle:116:in `<main>'
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
Before that, I’ve deployed a scaffold of the app to Heroku and everything went fine. But after working some time and pushing changes that error appeared.
Have already tried regenerating Gemlock.file and bundle update but without luck. Locally, everything works fine. Ruby and bundler versions are the same locally and on Heroku. Now, don’t have a clue, what that could be. Have anyone encountered such an error?
Found a solution. The problem was that rubocop amended the 42 line in /bin/bundle file to return gemfile if gemfile.present?, which through the error. I just revert it to the initial state of return gemfile if gemfile && !gemfile.empty? and everything worked. Hope, that will help someone.
Related
I have a Rails 7.x app I am trying to push to heroku and getting this error:
remote: Running: rake assets:precompile
remote: Compiling...
remote: Compilation failed:
remote: node:internal/crypto/hash:71
remote: this[kHandle] = new _Hash(algorithm, xofLen);
remote: ^
remote:
remote: Error: error:0308010C:digital envelope routines::unsupported
remote: at new Hash (node:internal/crypto/hash:71:19)
remote: at Object.createHash (node:crypto:133:10)
remote: at module.exports (/tmp/build_b1f32be4/node_modules/webpack/lib/util/createHash.js:135:53)
remote: at NormalModule._initBuildHash (/tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:417:16)
remote: at handleParseError (/tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:471:10)
remote: at /tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:503:5
remote: at /tmp/build_b1f32be4/node_modules/webpack/lib/NormalModule.js:358:12
remote: at /tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:373:3
remote: at iterateNormalLoaders (/tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
remote: at iterateNormalLoaders (/tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
remote: at /tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:236:3
remote: at context.callback (/tmp/build_b1f32be4/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
remote: at /tmp/build_b1f32be4/node_modules/babel-loader/lib/index.js:44:71 {
remote: opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
remote: library: 'digital envelope routines',
remote: reason: 'unsupported',
remote: code: 'ERR_OSSL_EVP_UNSUPPORTED'
remote: }
remote:
remote: Node.js v18.12.1
remote:
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
My node version locally is v18.12.1. I also saw a couple of issues where this might related to openssl. My openssl version local is OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022).
Any help appreciated!
I tried quite a few things in attempts to fix this issue, but I think what finally did it was adding
"engines": {
"node": "16.18.1"
}
...to my package.json file. Also I think the right way to do this is to go ahead and install the same version of node locally and re-run yarn install so your yarn.lock file is correct for that version.
Hope this helps someone!
While trying to deploy my app to heroku, I get this error:
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.10
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.5
remote: -----> Installing dependencies using bundler 2.3.10
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: Your bundle only supports platforms ["x86_64-darwin-21"] but your local platform
remote: is x86_64-linux. Add the current platform to the lockfile with
remote: `bundle lock --add-platform x86_64-linux` and try again.
remote: Bundler Output: Your bundle only supports platforms ["x86_64-darwin-21"] but your local platform
remote: is x86_64-linux. Add the current platform to the lockfile with
remote: `bundle lock --add-platform x86_64-linux` and try again.
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: b841b157d86386b34d46224f6f00301501c82b49
remote: !
remote: ! We have detected that you have triggered a build from source code with version b841b157d86386b34d46224f6f00301501c82b49
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to radiant-citadel-26297.
remote:
To https://git.heroku.com/radiant-citadel-26297.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/radiant-citadel-26297.git'
I have already tried
bundle lock --add-platform x86_64-linux
but didnt work. I have also tried to solve it with other methods, such as "bundle lock --add-platform ruby", with no success.
Please help!
The problem I had was that I was did not added, commited and pushed. This solved the issue: '
bundle lock --add-platform x86_64-linux
git add -A
git commit -m 'Add platform'
git push
'
I ran git push heroic master and got this long error message(truncated it). If I'm not wrong, this is the main cause of the problem remote: NoMethodError: undefined method 'split' for {}:Hash. How do I solve this problem from the terminal, even though the code runs on local machine. Please inform me if more information is required, and perhaps tell me what's wrong here.
Total 0 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Ruby,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.5.3
remote:
remote: ###### WARNING:
remote:
remote: You have the `.bundle/config` file checked into your repositor
remote: It contains local state like the location of the installed bundle
remote: as well as configured git local gems, and other settings that should
remote: not be shared between multiple checkouts of a single repo. Please
remote: remove the `.bundle/` folder from your repo and add it to your `.gitignore` file.
remote: https://devcenter.heroku.com/articles/bundler-configuration
remote:
remote: -----> Installing dependencies using bundler 1.15.2
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: --- ERROR REPORT TEMPLATE -------------------------------------------------------
remote: # Error Report
remote:
remote: ## Questions
remote:
remote: Please fill out answers to these questions, it'll help us figure out
remote: why things are going wrong.
remote:
remote: - **What did you do?**
remote:
remote: I ran the command `vendor/bundle/ruby/2.5.0/bin/bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment --no-clean`
remote:
remote: - **What did you expect to happen?**
remote:
remote: I expected Bundler to...
remote:
remote: - **What happened instead?**
remote:
remote: Instead, what happened was...
remote:
remote: - **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
remote:
remote: I tried...
remote:
remote: - **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**
remote:
remote: ...
remote:
remote: ## Backtrace
remote:
remote: ```
remote: NoMethodError: undefined method `split' for {}:Hash
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/settings.rb:253:in `get_array'
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/settings.rb:179:in `without'
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/install.rb:169:in `normalize_groups'
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/install.rb:24:in `run'
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:186:in `block in install'
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/settings.rb:92:in `temporary'
remote: /tmp/build_571ced5049bd8f6d5aa742e589ae07bf/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:185:in `install'
.bundle/config
---
BUNDLE_WITHOUT: ""
The logs are warning you about that you have .bundle/config checked on your version control.
Remove from your repo and push your changes
rm .bundle/config
rmdir .bundle
I'm making a new deployment to heroku and getting the following error, any ideas on how to fix this? Is bundler broken?
remote: Downloading countries-1.2.5 revealed dependencies not in the API or the lockfile
remote: (i18n_data (~> 0.7.0)).
remote: Either installing with `--full-index` or running `bundle update countries`
remote: should fix the problem.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
Due to the lack of context I'd try updating the gem and retrying, let us know if that works.
I am trying to push to heroku and I am getting the following error while compiling em.cpp
remote: em.cpp: In member function `void EventMachine_t::_RunEpollOnce()'
:
remote: em.cpp:574:37: error: `rb_thread_select' was not declared in this
scope
remote: EmSelect (0, NULL, NULL, NULL, &tv);
remote: ^
remote: em.cpp: In member function `int SelectData_t::_Select()':
remote: em.cpp:827:67: error: `rb_thread_select' was not declared in this
scope
remote: return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv
);
remote: ^
remote: em.cpp: In member function `void EventMachine_t::_RunSelectOnce()
':
remote: em.cpp:946:40: error: `rb_thread_select' was not declared in this
scope
remote: EmSelect (0, NULL, NULL, NULL, &tv);
remote: ^
remote: make: *** [em.o] Error 1
remote:
remote: make failed, exit code 2
remote:
remote: Gem files will remain installed in /tmp/build_3dd2419d1d67596ff83
72a3b46fb25f8/vendor/bundle/ruby/2.2.0/gems/eventmachine-1.0.3 for inspection.
remote: Results logged to /tmp/build_3dd2419d1d67596ff8372a3b46fb25f8/ven
dor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/eventmachine-1.0.3/ge
m_make.out
remote: Installing tzinfo 1.2.2
remote: Installing pg 0.18.1
remote: An error occurred while installing eventmachine (1.0.3), and Bund
ler cannot
remote: continue.
remote: Make sure that `gem install eventmachine -v '1.0.3'` succeeds bef
ore bundling.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote: ! Push rejected.
My app is written in rails 4.1.6 and postgres db.
Please help me sort this.
Thanks
EventMachine 1.0.3 has an issue with Ruby 2.2.x where it can't be compiled (https://github.com/eventmachine/eventmachine/issues/509). You'll need to upgrade to EventMachine 1.0.4 or above to be able to compile it using Ruby 2.2.x
As was said with the previous answer, changing your Ruby version to 2.1.2 can also help you solve the incompatibility. Add this at the top of your Gemfile:
# Gemfile
ruby '2.1.2'