我幾個小時都在爲這個錯誤而頭痛,並且還沒有找到修復。當我使用sudo -u root -H RAILS_ENV=production script/background_jobs start
運行sidekiq我得到這個錯誤在sidekiq.log:Gitlab錯誤:Sidekiq; gemfile語法錯誤
Gemfile syntax error:
/home/website/git/gitlab/Gemfile:20: syntax error, unexpected ':', expecting $end
gem "mysql2", group: :mysql
我已經安裝了Ruby 2.1.0和正在運行CentOS的。我看過其他帖子出現這個錯誤,他們的問題是他們運行的是Ruby 1.8,但是,我運行的是Ruby 2.1.0,並且也出現了這個錯誤。
任何幫助,非常感謝。
編輯:我的Gemfile http://pastebin.com/T5z4GZ3a
bundle
回報
Your bundle is complete!
Gems in the groups development, test, postgres, puma and aws were not installed.
It was installed into ./vendor/bundle
EDIT2:我background_jobs
腳本http://pastebin.com/kdicTFqk
bundle show bundler
回報
2.1.0
/usr/local/rvm/gems/[email protected]/gems/bundler-1.5.2
EDIT3:我認爲我已經找到了問題,但不知道如何解決它。我添加了p RUBY_VERSION
作爲我的Gemfile的第一行,然後我改變了這樣寫的每一行:group: :mysql
到這個:group => :mysql
(因爲這是對舊版本的工作)。
然而,當我現在運行Sidekiq,這表明了在sidekiq.log:
"1.8.7"
bundler: command not found: sidekiq
Install missing gem executables with `bundle install`
我真的,真的糊塗了。在這裏它清楚地表明我的Ruby版本是1.8.7,但這是不對的。 ruby -v
或rvm list rubies
只顯示安裝了Ruby 2.1.0,並將其設置爲默認值。
請發佈您的整個Gemfile。還要在你的Gemfile的開頭放一個'puts RUBY_VERSION'來驗證你使用的是正確的版本並做一個'bundle'。 – Agis
@Agis更新後。如果我在開頭添加'puts RUBY_VERSION',當我運行'bundle exec rake gitlab:檢查RAILS_ENV = production'時,它會在開始時輸出版本號2.1.0。 – Martyn
也顯示'bundle show bundler'的輸出,並嘗試用'gem「mysql2」,group =>替換該行:mysql' –