Redmine-4.1.1解決錯誤:error evaluating `Gemfile`: This Gemfile contains multiple primary sources.

安裝插件CKEditor時出現此錯誤。

環境

  • Ubuntu 20.04.2LTS server無圖形界面
  • Redmine-4.1.1
  • # samxiao @ rm411 in ~/redmine-4.1.1 [18:04:44]
    $ gem -v
    3.1.4
    $ ruby -v
    ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
    $ rake -V
    rake, version 13.0.3
    $ rails -v
    Rails 5.2.4.2
    
    # samxiao @ rm411 in ~ [18:06:08]
    $ rails -v
    Rails 6.1.3
    
    
    

問題現象

	# samxiao @ rm411 in ~/redmine-4.1.1/plugins [11:33:43] C:130
	$ bundle config set disable_multisource true
	
	# samxiao @ rm411 in ~/redmine-4.1.1/plugins [11:33:49]
	$ bundle install
	
	[!] There was an error parsing `Gemfile`:
	[!] There was an error evaluating `Gemfile`: This Gemfile contains multiple primary sources. Each source after the first must include a block to indicate which gems should come from that source. Bundler cannot continue.
#  from /home/samxiao/redmine-4.1.1/plugins/redmine_ckeditor/Gemfile:1
	 #  -------------------------------------------
	 >  source 'https://rubygems.org'
	 #
	 #  -------------------------------------------
	. Bundler cannot continue.
	
	 #  from /home/samxiao/redmine-4.1.1/Gemfile:101
	 #  -------------------------------------------
	 #  Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
	 >    eval_gemfile file
	 #  end
	 #  -------------------------------------------
	
	# samxiao @ rm411 in ~/redmine-4.1.1/plugins [11:33:54] C:4
	$

 

原因:有兩個gem源產生了衝突

系統指定的:

# samxiao @ rm411 in /etc/netplan [9:35:03]
$ gem source -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/

 ckeditor插件指定的:

# samxiao @ rm411 in ~/redmine-4.1.1/plugins/redmine_ckeditor [11:37:04]
$ cat Gemfile
source 'https://rubygems.org'

gem 'rich', git: 'https://github.com/a-ono/rich.git', tag: '1.5.2'
gem 'kaminari'
gem 'htmlentities'
gem 'paperclip', '~> 6.1.0'
gem 'pandoc-ruby'

解決方法

註釋掉插件中指定的源:https://rubyges.org

 

解決過程

# samxiao @ rm411 in ~/redmine-4.1.1/plugins/redmine_ckeditor [11:37:04]
$ cat Gemfile
source 'https://rubygems.org'

gem 'rich', git: 'https://github.com/a-ono/rich.git', tag: '1.5.2'
gem 'kaminari'
gem 'htmlentities'
gem 'paperclip', '~> 6.1.0'
gem 'pandoc-ruby'

# It is needed for upgrading CKEditor
#gem 'sprockets-rails', '< 3.0.0'

# samxiao @ rm411 in ~/redmine-4.1.1/plugins/redmine_ckeditor [11:37:08]
$ vi Gemfile

# samxiao @ rm411 in ~/redmine-4.1.1/plugins/redmine_ckeditor [11:37:34]
$ cat Gemfile
#xsz source 'https://rubygems.org'

gem 'rich', git: 'https://github.com/a-ono/rich.git', tag: '1.5.2'
gem 'kaminari'
gem 'htmlentities'
gem 'paperclip', '~> 6.1.0'
gem 'pandoc-ruby'

# It is needed for upgrading CKEditor
#gem 'sprockets-rails', '< 3.0.0'

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章