部署 部署 GitLab 报错 undefined method `token_authentication_key=' for Devise:Module

807298233 · 2015年06月30日 · 最后由 qilinzou 回复于 2015年11月25日 · 3632 次阅读
bundle exec rake gitlab:setup RAILS_ENV=production
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
rake aborted!
NoMethodError: undefined method `token_authentication_key=' for Devise:Module
/home/git/gitlab/config/initializers/devise.rb:157:in `block in <top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/devise-3.5.1/lib/devise.rb:281:in `setup'
/home/git/gitlab/config/initializers/devise.rb:3:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/git/gitlab/config/environment.rb:5:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
/home/git/gitlab/vendor/bundle/ruby/2.2.0/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
Tasks: TOP => gitlab:setup => environment
(See full trace by running task with --trace)

@huacnlee 可以帮我看下吗

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] 这是 ruby 版本

我是按照 install from source一步一步来的 系统是 Ubuntu Ruby 2.1.6

devise  : token_authentication_key

???这样对么?

#2 楼 @807298233 问题解决了吗?贴出 /home/git/gitlab/config/initializers/devise.rb 看一下有没有 devise :token_authenticatable, ... 这行代码

我记得 gitlab 不是有 deb/rpm 包么?

#6 楼 @rei 有,但开 ss 都下载不来!!!

#5 楼 @tiseheaini 这是第 157 行代码 config.token_authentication_key = :private_token

我系统是 centos

#9 楼 @807298233 看一下 user model 里面有没有开启 token_authenticatable 服务

#10 楼 @tiseheaini 我换了个分支 没这个错误了 估计是 ruby 版本问题我的 gitlab 分支是 5-1-stable 但我的 ruby 版本是最新的 2.2.x

#10 楼 @tiseheaini service gitlab start Starting unicorn: [!] There was an error parsing Gemfile: compile error - syntax error, unexpected ':', expecting $end gem "mysql2", group: :mysql ^. Bundler cannot continue.

# from /home/git/gitlab/Gemfile:21 # ------------------------------------------- # # Supported DBs

gem "mysql2", group: :mysql # gem "pg", group: :postgres # ------------------------------------------- [FAILED] Starting sidekiq: [FAILED]

曾经我也 install from source,但后来发现了 deb/rpm 包,就果断用包安装了,分分钟搞定,无 bug。

devise-token_authenticatable 可解决

需要 登录 后方可回复, 如果你还没有账号请 注册新账号