Spree: heroku deploy error - ruby-on-rails

I keep getting following:
remote: Gem::InstallError: spree_core requires Ruby version >= 2.1.0.
remote: An error occurred while installing spree_core (3.0.4), and Bundler cannot
remote: continue.
remote: Make sure that `gem install spree_core -v '3.0.4'` succeeds before bundling.
when I run
gem install spree_code -v '3.0.4'
it is successful and afterwards when I run git push heroku master again I get the exact same error.
rbenv versions
shows following:
2.2.2 (set by /Users/Martijn/.rbenv/version)

Heroku needs the ruby version defined in the Gemfile, like:
ruby "2.2.1". More info: https://devcenter.heroku.com/articles/ruby-versions.

Related

Heroku push rejected error: Failed to install gems via Bundler (probably caused by mimemagic)

I try to push my project on heroku and error message pop outs
git push heroku master
remote: -----> Building on the Heroku-18 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.11
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.3
remote: -----> Installing dependencies using bundler 2.2.11
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: Fetching gem metadata from https://rubygems.org/............
remote: **Your bundle is locked to mimemagic (0.3.5), but that version could not be found**
remote: in any of the sources listed in your Gemfile. If you haven't changed sources,
remote: that means the author of mimemagic (0.3.5) has removed it. You'll need to update
remote: your bundle to a version other than mimemagic (0.3.5) that hasn't been removed
remote: in order to install.
remote: Bundler Output: Fetching gem metadata from https://rubygems.org/............
remote: Your bundle is locked to mimemagic (0.3.5), but that version could not be found
remote: in any of the sources listed in your Gemfile. If you haven't changed sources,
remote: that means the author of mimemagic (0.3.5) has removed it. You'll need to update
remote: your bundle to a version other than mimemagic (0.3.5) that hasn't been removed
remote: in order to install.
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: !
I guess the problem is caused by rails gem mimemagic's version is out of date so I try to update to the latest version, it still doesn't work.
Here's my ruby, Rails, mimemagic version
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
rails -v
Rails 6.1.3.1
bundle info mimemagic
* mimemagic (0.4.3)
information in Gemfile
gem 'rails', '~> 6.1', '>= 6.1.0'
gem 'bundler', '~> 2.2', '>= 2.2.1.1'
gem 'mimemagic', '~> 0.4.3'
in Gemfile.lock
mimemagic (~> 0.4.3)
run bundle update mimemagic worked for me
Change version of mimemagic to 0.3.10 in your Gemfile
Mimemagic seems to be experiencing updates? hopefully will be fixed soon. Try changing mimemagic to previous version for now..
Gemfile:
gem 'mimemagic', '~> 0.3.10'
Running bundle update will automatically update every dependency on your app to the latest version

I get following error with running bundle install . I installed railsinstaller-3.2.1.exe from railsinstaller.org

Gem::InstallError: nio4r requires Ruby version >= 2.3.
An error occurred while installing nio4r (2.5.2), and Bundler cannot continue.
Make sure that gem install nio4r -v '2.5.2' succeeds before bundling.

Can't downgrade bundler

I try to install a project I cloned. When I do 'bundle install' I have the following message:
$ bundle install
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.6.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
So i did the following:
gem uninstall bundler
gem install bundler --version '1.0.0'
Successfully installed bundler-1.0.0
1 gem installed
I do 'bundle install', and I keep having the same message:
$ bundle install
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.6.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
It seems that I cannot downgrade bundler to the '1.0.0' version, any idea?
If you do not need multiple versions of Bundler, you can uninstall the newer version:
$ gem uninstall bundler -v 1.6.2
You can also choose from a list of bundler versions if you have more than one:
$ gem uninstall bundler
You'll need to hit the global instance (alter installed ruby version as needed) --
$ gem uninstall -i /Users/<user>/.rvm/gems/ruby-2.3.8#global bundler

Gem::LoadError when trying to use forked gem

My goal is to use libmspack. It depends on ffi-compiler, I've forked ffi-compiler, to add some custom code, and I want libmspack to use my modified version.
I have a simple Gemfile:
source 'http://rubygems.org'
gem 'ffi-compiler', :github =>'survili/ffi-compiler'
gem 'libmspack'
When running 'bundle install', installation of 'ffi-compiler' completes fine, but 'libmspack' install fails with an error that it can't find 'ffi-compiler'.(LoadError: cannot load such file -- ffi-compiler/compile_task)
I've noticed that if I remove 'libmspack' from Gemfile, and try to install it using 'bundle exec install libmspack', it works fine.
Can someone explain, what is the correct way to achieve my goal, causing libmspack to use custom ffi-compiler gem ?
I've found this SO post, which asks the same, but has no answer: Gem::LoadError when using a git repo in Gemfile
Thank you in advance
------ OUTPUT of bundle(empty gemset using RVM) -------
jackju at macbook-air ~/tmp/delme1
$ rvm use 2.1.1#stackoverproblem --create
ruby-2.1.1 - #gemset created /home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem
ruby-2.1.1 - #generating stackoverproblem wrappers...........
Using /home/jackju/.rvm/gems/ruby-2.1.1 with gemset stackoverproblem
jackju at macbook-air ~/tmp/delme1
$ rvm current
ruby-2.1.1#stackoverproblem
jackju at macbook-air ~/tmp/delme1
$ vim Gemfile
[1]+ Stopped vim Gemfile
jackju at macbook-air ~/tmp/delme1
$ rvm current
ruby-2.1.1#stackoverproblem
jackju at macbook-air ~/tmp/delme1
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.4)
bundler (1.5.3)
bundler-unload (1.0.2)
executable-hooks (1.3.1)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.3)
rake (10.1.0)
rdoc (4.1.0)
rubygems-bundler (1.4.2)
rvm (1.11.3.9)
test-unit (2.1.1.0)
jackju at macbook-air ~/tmp/delme1
$ bundle
Fetching git://github.com/survili/ffi-compiler.git
remote: Reusing existing pack: 260, done.
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 265 (delta 2), reused 0 (delta 0)
Receiving objects: 100% (265/265), 38.59 KiB | 0 bytes/s, done.
Resolving deltas: 100% (116/116), done.
Fetching gem metadata from http://rubygems.org/.........
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies...
Installing rake (10.3.1)
Installing ffi (1.9.3)
Using ffi-compiler (0.1.4) from git://github.com/survili/ffi-compiler.git (at master)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/jackju/.rvm/rubies/ruby-2.1.1/bin/ruby -rubygems /home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem/gems/rake-10.3.1/bin/rake RUBYARCHDIR=/home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem/extensions/x86_64-linux/2.1.0/libmspack-0.0.4 RUBYLIBDIR=/home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem/extensions/x86_64-linux/2.1.0/libmspack-0.0.4
rake aborted!
LoadError: cannot load such file -- ffi-compiler/compile_task
/home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem/gems/libmspack-0.0.4/ext/Rakefile:1:in `<top (required)>'
(See full trace by running task with --trace)
rake failed, exit code 1
Gem files will remain installed in /home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem/gems/libmspack-0.0.4 for inspection.
Results logged to /home/jackju/.rvm/gems/ruby-2.1.1#stackoverproblem/extensions/x86_64-linux/2.1.0/libmspack-0.0.4/gem_make.out
An error occurred while installing libmspack (0.0.4), and Bundler cannot
continue.
Make sure that `gem install libmspack -v '0.0.4'` succeeds before bundling.
jackju at macbook-air ~/tmp/delme1
$ ls
Gemfile
jackju at macbook-air ~/tmp/delme1
$
The problem is missing 'rubygems/tasks' which is found in this gem: https://github.com/postmodern/rubygems-tasks.
I was able to install libmspack on my machine following these steps:
gem install rubygems-tasks
git clone git#github.com:survili/ffi-compiler.git
cd ffi-compiler
rake build gem
gem install pkg/ffi-compiler-0.1.4.gem
gem install libmspack -v '0.0.4'
Successfully installed libmspack-0.0.4
1 gem installed

Problems with bundle (Rails)

I'm running Ruby 1.9.3 and Rails 4.0.0, and I'm just starting to learn how to use Ruby on Rails. Whenever I type the command to create a project:
rails new blog
I get this error when the bundle tries to execute the "bundle install" command:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.0.0) ruby depends on
bundler (< 2.0, >= 1.3.0) ruby
Current Bundler version:
bundler (1.2.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
But with the command:
gem list bundle
returns:
bundler (1.3.5, 1.2.3)
And the command:
bundle -v
returns:
Bundler version 1.3.5
I don't know why that's happening, I appreciate any help, thanks.
Try removing the version in your Gemfile. Just keep
gem 'bundler'
Now run
bundle update
Try check Gemfile.lock for used bundler version.
You also can try to uninstall old version:
gem uninstall bundler --version 1.2.3
You can also specify the version of bundler you want to use
bundle _1.3.5_ install

Resources