5

我已经安装了 Gitlab 5,一切运行顺利,直到我尝试进行测试 PUSH。错误是:

remote: /usr/local/rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.5/lib/bundler/dsl.rb:33:in `eval_gemfile': Gemfile syntax error: (Bundler::GemfileError)        
remote: /home/git/gitlab/Gemfile:14: syntax error, unexpected ':', expecting $end        
remote: gem "mysql2", group: :mysql        
remote:                     ^          

我在整个互联网上搜索(嗯,有点),但大多数答案是关于使用较低版本的 ruby​​(1.8.7)。如您所见,这里不是这种情况,我使用的是 2.0.0-p0。

我也附上了 Gemfile,它来自 Gitlab 源代码,所以我认为它没有任何问题。以防万一:

source "https://rubygems.org"

def darwin_only(require_as)
  RUBY_PLATFORM.include?('darwin') && require_as
end

def linux_only(require_as)
  RUBY_PLATFORM.include?('linux') && require_as
end

gem "rails", "3.2.13"

# Supported DBs
gem "mysql2", group: :mysql
gem "pg", group: :postgres

# Auth
gem "devise"
gem 'omniauth', "~> 1.1.3"
gem 'omniauth-google-oauth2'
gem 'omniauth-twitter'
gem 'omniauth-github'

# Extracting information from a git repository
# Since gollum requires grit we cannot use gitlab-grit gem name any more. Use grit instead
gem "grit", '~> 2.5.0', git: 'https://github.com/gitlabhq/grit.git', ref: '42297cdcee16284d2e4eff23d41377f52fc28b9d'
gem 'grit_ext', '~> 0.8.1'

# Ruby/Rack Git Smart-HTTP Server Handler
gem 'gitlab-grack', '~> 1.0.0', require: 'grack'

# LDAP Auth
gem 'gitlab_omniauth-ldap', '1.0.2', require: "omniauth-ldap"

# Syntax highlighter
gem "gitlab-pygments.rb", '~> 0.3.2', require: 'pygments.rb'

# Language detection
gem "github-linguist", "~> 2.3.4" , require: "linguist"

# API
gem "grape", "~> 0.3.1"
gem "grape-entity", "~> 0.2.0"

# Format dates and times
# based on human-friendly examples
gem "stamp"

# Enumeration fields
gem 'enumerize'

# Pagination
gem "kaminari", "~> 0.14.1"

# HAML
gem "haml-rails"

# Files attachments
gem "carrierwave"

# Authorization
gem "six"

# Seed data
gem "seed-fu"

# Markdown to HTML
gem "redcarpet",     "~> 2.2.2"
gem "github-markup", "~> 0.7.4", require: 'github/markup'

# Servers
gem "puma", '~> 2.0.0.b7'

# State machine
gem "state_machine"

# Issue tags
gem "acts-as-taggable-on", "2.3.3"

# Background jobs
gem 'slim'
gem 'sinatra', require: nil
gem 'sidekiq'

# HTTP requests
gem "httparty"

# Colored output to console
gem "colored"

# GitLab settings
gem 'settingslogic'

# Git Wiki
gem "gollum-lib", "~> 1.0.0"

# Misc
gem "foreman"

# Cache
gem "redis-rails"

group :assets do
  gem "sass-rails",   "~> 3.2.5"
  gem "coffee-rails", "~> 3.2.2"
  gem "uglifier",     "~> 1.3.0"
  gem "therubyracer"

  gem 'chosen-rails',     "0.9.8"
  gem 'select2-rails'
  gem 'jquery-atwho-rails', "0.1.7"
  gem "jquery-rails",     "2.1.3"
  gem "jquery-ui-rails",  "2.0.2"
  gem "modernizr",        "2.6.2"
  gem "raphael-rails",    git: "https://github.com/gitlabhq/raphael-rails.git"
  gem 'bootstrap-sass',   "2.2.1.1"
  gem "font-awesome-sass-rails", "~> 3.0.0"
  gem "gemoji", "~> 1.2.1", require: 'emoji/railtie'
  gem "gon"
end

group :development do
  gem "annotate", git: "https://github.com/ctran/annotate_models.git"
  gem "letter_opener"
  gem 'quiet_assets', '~> 1.0.1'
  gem 'rack-mini-profiler'
  # Better errors handler
  gem 'better_errors'
  gem 'binding_of_caller'

  gem 'rails_best_practices'

  # Docs generator
  gem "sdoc"

  # thin instead webrick
  gem 'thin'
end

group :development, :test do
  gem 'coveralls', require: false
  gem 'rails-dev-tweaks'
  gem 'spinach-rails'
  gem "rspec-rails"
  gem "capybara"
  gem "pry"
  gem "awesome_print"
  gem "database_cleaner"
  gem "launchy"
  gem 'factory_girl_rails'

  # Generate Fake data
  gem "ffaker"

  # Guard
  gem 'guard-rspec'
  gem 'guard-spinach'

  # Notification
  gem 'rb-fsevent', require: darwin_only('rb-fsevent')
  gem 'growl',      require: darwin_only('growl')
  gem 'rb-inotify', require: linux_only('rb-inotify')

  # PhantomJS driver for Capybara
  gem 'poltergeist', git: 'https://github.com/jonleighton/poltergeist.git', ref: '9645b52009e258921b860d3b7601d00008b22c45'

  gem 'spork', '~> 1.0rc'
end

group :test do
  gem "simplecov", require: false
  gem "shoulda-matchers", "1.3.0"
  gem 'email_spec'
  gem "webmock"
  gem 'test_after_commit'
end

group :production do
  gem "gitlab_meta", '5.0'
end

有人可以帮忙吗?提前致谢。

4

6 回答 6

5

解决了这个问题。不知何故,Gitlab gems (bundles?) 仍然使用系统 ruby​​ (1.8.7)。我不得不这样yum remove做,现在一切正常。

于 2013-05-07T10:38:34.820 回答
1

在完全相同的问题上花费了大约 3 个小时后,解决方案如下:An Phan

执行 $ rpm -qa | grep -i 红宝石

它会给你像ruby.1.8 .. *

做 yum 擦除 ruby​​.1.8.. *

于 2014-08-07T20:59:45.420 回答
1

问题 3080GitLab 要求部分所述

红宝石 1.9.3

我会先尝试切换到 ruby​​1.9.3(当然不是 1.8.x)。

于 2013-05-07T05:19:50.810 回答
0

当我尝试为我合并时,我遇到了 gitlab 的问题。当 git 运行一个钩子时,它会修改环境路径。在我的机器上,它将 /usr/libexec/git-core 和 /usr/bin 添加到路径的开头。

所以#!/usr/bin/env ruby运行的 gitlab-shell 更新钩子 shebang,它总是会在 /usr/bin 中拾取系统 ruby​​,而不是查看 rvm 路径(类似于 /home/git/.rvm/gems/ruby-2.0.0- p353/bin)。

删除系统 ruby​​ 或修改 shebang 以直接运行 rvm ruby​​ 应该可以工作。

于 2014-02-18T04:28:57.683 回答
0

你可以试试:

group :mysql do 
  gem "mysql2"
end

group :postgres do 
  gem "pg"
end
于 2013-05-07T04:21:10.997 回答
0

尝试这个:

vendor/bundle将1.9.3 与 rvm 一起使用时,完全删除该文件夹并重新运行部署命令。

于 2013-05-07T09:36:56.910 回答