Heroku: Cannot push to heroku due to NoMethodError - ruby-on-rails

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

Related

Pushing Rails app to heroku gives me Error: error:0308010C:digital envelope routines::unsupported

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!

Heroku Deploying: Failed to install gems via Bundler

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
'

Heroku bundler undefined method "present?", fails to install gems via bundler

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.

Errors with "git push heroic master", what to do?

So i'm trying to deploy my rails app through heroku. But every time i run "git push heroic master", i run into this. I have searched around, but nothing seems to work. I have tried to "bundle update", "bundle install", but i still get this error when i run "git push heroic master"
Counting objects: 84, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (70/70), done.
Writing objects: 100% (84/84), 20.65 KiB | 1.88 MiB/s, done.
Total 84 (delta 2), 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.3.4
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: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote: The dependencies in your gemfile changed
remote: You have added to the Gemfile:
remote: * pg
remote: Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run `bundle install` elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: The dependencies in your gemfile changed
remote:
remote: You have added to the Gemfile:
remote: * pg
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to secret-mesa-55611.
remote:
To https://git.heroku.com/******
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/*******.git'
It seems that your Gemfile.lock is changed. Try running bundle install after cleaning the Gemfile.lock

Could not find thread_safe-0.3.5 in any of the sources

I get this error while running cap production deploy on a Ubuntu 14.04 server.
It seems like a similar issue to here, but I've tried all the answers here but can't get it working Could not find thread_safe-0.3.0 in any of the sources.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as root#*serveripaddress*: bundle exit status: 7
bundle stdout: Could not find thread_safe-0.3.5 in any of the sources
bundle stderr: Nothing written
SSHKit::Command::Failed: bundle exit status: 7
bundle stdout: Could not find thread_safe-0.3.5 in any of the sources
bundle stderr: Nothing written
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as root#*serveripaddress*: bundle exit status: 7
bundle stdout: Could not find thread_safe-0.3.5 in any of the sources
bundle stderr: Nothing written
Update: I've tried deploying to Heroku and get a similar error. If anyone has any advice it would be great.
$ git push heroku master
Counting objects: 10017, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7613/7613), done.
Writing objects: 100% (10017/10017), 22.27 MiB | 87.00 KiB/s, done.
Total 10017 (delta 2426), reused 7631 (delta 1548)
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.0.0
remote: -----> Installing dependencies using 1.7.12
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Some gems seem to be missing from your vendor/cache directory.
remote: Could not find thread_safe-0.3.5 in any of the sources
remote: Bundler Output: Some gems seem to be missing from your vendor/cache directory.
remote: Could not find thread_safe-0.3.5 in any of the sources
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to mysterious-badlands-3241.
remote:

Resources