我无法在Ruby9上使用任何红宝石宝石 [英] I can't get any ruby gems to work on Cloud9

查看:217
本文介绍了我无法在Ruby9上使用任何红宝石宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在本地计算机上正常运行gem,但是在Cloud9上,我一直在获取 require:无法加载此类文件。我在使用多个gem时遇到了这个问题,我不知道自己在做什么错。

I get gems to work fine on my local machine, but on Cloud9 I keep getting `require': cannot load such file. I've had this problem with multiple gems and I don't know what I'm doing wrong.

我已经安装了gem,并将其添加到我的gem文件中,捆绑安装。它显示在我的宝石列表中。
这是捆绑包显示中的路径

I have installed the gem, added it to my gem file and did bundle install. It shows in my gem list. Here is the path for it from bundle show

/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/test_linker-1.0.1

这是我的环境路径

GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.1.5@rails4
     - /usr/local/rvm/gems/ruby-2.1.5@global


推荐答案

我有同样的问题。 ENV变量在终端和运行器之间不同步。如果您运行

I had the same issue. The ENV variables get out of sync between the terminal and the Runner. If you run

exec 'env'

$来自ruby脚本的b
$ b

,它显示的GEM_PATH和GEM_HOME可能与您在终端上看到的有所不同。

from a ruby script, it may show different GEM_PATH and GEM_HOME than you'll see from the terminal.

要同步它们,我必须从〜/ .profile文件中的env中删除对@ rails4的引用。 (只需将它们在.profile中设置为与跑步者中的内容完全一样。)

To sync them, I had to remove references to @rails4 from env in the ~/.profile file. (just set them in .profile to exactly what they are in the Runner.)

GEM_PATH=/usr/local/rvm/gems/ruby-2.1.4:/usr/local/rvm/gems/ruby-2.1.4@global
GEM_HOME=/usr/local/rvm/gems/ruby-2.1.4

此Runner运行不带Rails的ruby脚本。如果需要Rails,则可以基于Ruby on Rails Runner创建运行配置。

This Runner runs ruby scripts without Rails. If you want Rails you can create a Run Configuration based on the Ruby on Rails Runner.

如果您可以更改单个Runner中的ENV变量,那就太好了。右上角有一个ENV按钮,但是尝试覆盖GEM_HOME和路径无效。

It would be nice if you could change the ENV variables in the individual Runners. There is an ENV button at the top right, but trying to override GEM_HOME and path there has no effect.

这篇关于我无法在Ruby9上使用任何红宝石宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆