简体   繁体   中英

Bundle Install Issues after adding gem “font-awesome-rails”

I am using a tutorial from Udemy to create a web app and I am using the cloud9 IDE. Everything was working fine until adding font-awesome. When trying bundle install after adding the font-awesome gem, I am getting the following errors:

Bundler could not find compatible versions for gem "activemodel":
  In Gemfile:
    rails (~> 5.2.0) was resolved to 5.2.1.rc1, which depends on
      activemodel (= 5.2.1.rc1)

    web-console (>= 3.3.0) was resolved to 3.3.0, which depends on
      activemodel (>= 4.2)

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    jbuilder (~> 2.5) was resolved to 2.8.0, which depends on
      activesupport (>= 4.2.0)

    rails (~> 5.2.0) was resolved to 5.2.1.rc1, which depends on
      activesupport (= 5.2.1.rc1)

    spring was resolved to 2.0.2, which depends on
      activesupport (>= 4.2)

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    coffee-rails (~> 4.2) was resolved to 4.2.2, which depends on
      railties (>= 4.0.0)

    font-awesome-rails (= 4.2.0) was resolved to 4.2.0.0, which depends on
      railties (< 5.0, >= 3.2)

    jquery-rails was resolved to 4.3.3, which depends on
      railties (>= 4.2.0)

    rails (~> 5.2.0) was resolved to 5.2.1.rc1, which depends on
      railties (= 5.2.1.rc1)

    sass-rails (~> 5.0) was resolved to 5.0.7, which depends on
      railties (< 6, >= 4.0.0)

    web-console (>= 3.3.0) was resolved to 3.3.0, which depends on
      railties (>= 4.2)

Here are my current gem files:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.4.1'

gem 'rails', '~> 5.2.0'

gem 'sqlite3', group: [:development, :test]


gem 'bootstrap-sass', '~> 3.3.7'

gem "font-awesome-rails", '4.2.0'


gem 'jquery-rails'

group :production do
  gem 'pg'
  gem 'rails_12factor'

end


gem 'puma', '~> 3.11'

gem 'sass-rails', '~> 5.0'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.2'

gem 'turbolinks', '~> 5'

gem 'jbuilder', '~> 2.5'

gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 3.3.0'

  gem 'listen', '>= 3.0.5', '< 3.2'

  gem 'spring'

  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do

  gem 'capybara', '>= 2.15', '< 4.0'

  gem 'selenium-webdriver'

  gem 'chromedriver-helper'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

So after searching similar issues, I have tried deleting my gemlock file and running bundle update, but it hasn't worked. Attempting to run my server just gives me an error that 'font-awesome-rails' bundle needs to be installed first.

Also apologies for formatting, it's my first question here. Any help is appreciated.

The problem is the following constraint:

gem "font-awesome-rails", '4.2.0'

As the following part explains:

font-awesome-rails (= 4.2.0) was resolved to 4.2.0.0, which depends on
  railties (< 5.0, >= 3.2)

the version 4.2 of font-awesome-rails requires Rails < 5.0, but you are using Rails 5.2.0, so bundler does not know what to do (you can't have several versions of a given gem).

The solution is to us a versionless gem declaration:

gem "font-awesome-rails"

Don't worry about the version of that gem, bundler is smart enough to give you the latest compatible version!

Note : You could also use the pessimistic operator , as in :

gem "font-awesome-rails", '~> 4.2'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM