当我在 section Ruby 上执行“sudo gem install bundler”命令时,我正在 Ubuntu 10 上安装 gitlab-5.0 gitlab 安装指南,它向我展示了下一个冲突:
root@ubuntu:/home/gitlab/gitlab# sudo gem install bundler
Successfully installed bundler-1.3.4
Installing ri documentation for bundler-1.3.4
/usr/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block
/usr/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block
Done installing documentation for bundler after 8 seconds
1 gem installed
root@ubuntu:/home/gitlab/gitlab#
然后,在section Gems上...
root@ubuntu:/home/gitlab/gitlab# sudo gem install charlock_holmes --version '0.6.9'
Building native extensions. This could take a while...
Successfully installed charlock_holmes-0.6.9
Installing ri documentation for charlock_holmes-0.6.9
/usr/lib/ruby/1.8/rdoc/rdoc.rb:280: warning: conflicting chdir during another chdir block
/usr/lib/ruby/1.8/rdoc/rdoc.rb:287: warning: conflicting chdir during another chdir block
Done installing documentation for charlock_holmes after 0 seconds
1 gem installed
root@ubuntu:/home/gitlab/gitlab# sudo -u git -H bundle install --deployment --without development test postgres
Gemfile syntax error:
/home/gitlab/gitlab/Gemfile:14: syntax error, unexpected ':', expecting $end
gem "mysql2", group: :mysql
我的 ruby 版本:
root@ubuntu:/home/gitlab/gitlab# ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
如何避免此错误?
最佳答案
堆栈跟踪表明您确实没有使用 Ruby 2.0 来安装 gem,而是使用系统提供的 1.8.7。这可能是由于您使用 sudo
引起的。
如果您使用 RVM 安装了 Ruby 2.0.0,则必须使用 rvmsudo
来代替,这将确保 rvm 对 $PATH
所做的更改能够加载以 root 身份运行的程序将可以使用特定的 ruby 版本。默认情况下,sudo
会清理$PATH
并重新发起更改。
关于ruby-on-rails - 安装 gitlab-5.0 时遇到问题。我无法完成安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15588741/