【发布时间】:2016-09-27 21:45:30
【问题描述】:
我一直在将 Ruby on Rails 与 postgresql 一起使用,并且有人建议我应该安装 RVM,我这样做了(我认为这是利用 Phonegap)。自从我安装了 RVM 以来,我一直无法执行 bundle install,这反过来意味着我无法再运行其他 rails 命令。
大量阅读并没有真正给我答案,但我有很多想法。也许有人可以帮助将这些想法集中到解决方案中?
当我运行bundle install 时,似乎有 3 个 gem 会导致问题,但我认为它们是相互关联的。它们是byebug 8.2.2 和pg 0.18.4 和binding_of caller 0.7.2
byebug-8.2.2/gem_make_out的内容如下:
/home/damo/.rvm/rubies/jruby-9.0.5.0/bin/jruby -r ./siteconf20160927-16151-j7mhkf.rb extconf.rb
NotImplementedError: C extensions are not supported
<top> at /home/damo/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/mkmf.rb:1
require at org/jruby/RubyKernel.java:937
(root) at /home/damo/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
<top> at extconf.rb:6
extconf failed, exit code 1
当我查看byebug issues 时,它只是说 byebug 不支持 jruby。
我在安装 RVM 之前没有遇到任何问题,而且我确定我读到 byebug 已硬连线到 Rails 4。我想告诉你我的 Rails 版本,但rails -v 给了我一个回应
Could not find proper version of railties (4.2.5) in any of the sources
Run `bundle install` to install missing gems.
这似乎是我的 Catch 22!
【问题讨论】:
-
好的,现在一切正常。根据下面的回复,我假设安装 RVM 将我切换到默认的 jRuby。在我设置
rvm use ruby-2.3.0并重新安装bundler之后,我就能够bundle install并修复东西。为了确保我不会遇到类似的问题,我运行了rvm default runy-2.3.0。顺便说一句,我不得不chmod一些目录授予我安装 gems 的读/写访问权限。 -
要更改默认 ruby,正确的指令是
rvm --default use <NUMBER>。重新启动后,gem install pg -v '0.18.4仍然存在一些问题。我不知道为什么,但我需要sudo yum install postgresql-devel,我预计现在需要使用它。无论如何,现在似乎一切正常。
标签: ruby-on-rails postgresql rvm bundler