簡體   English   中英

添加寶石“ font-awesome-rails”后的捆綁安裝問題

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

我正在使用Udemy的教程來創建Web應用程序,並且正在使用cloud9 IDE。 一切工作正常,直到添加了真棒字體。 在添加超棒的gem之后嘗試捆綁安裝時,出現以下錯誤:

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)

這是我當前的gem文件:

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]

因此,在搜索了類似的問題之后,我嘗試刪除我的gemlock文件並運行捆綁軟件更新,但沒有成功。 嘗試運行服務器只會給我一個錯誤,需要首先安裝'font-awesome-rails'軟件包。

還要為格式道歉,這是我的第一個問題。 任何幫助表示贊賞。

問題是以下約束:

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

如以下部分所述:

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

font-awesome-rails 4.2版本要求Rails <5.0,但是您使用的是Rails 5.2.0,因此bundler不知道要做什么(給定gem不能有多個版本)。

解決方案是為我們提供無版本的gem聲明:

gem "font-awesome-rails"

不必擔心該gem的版本,捆綁程序足夠聰明,可以為您提供最新的兼容版本!

注意:您也可以使用悲觀運算符 ,如:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM