I can't get any ruby gems to work on Cloud9

怎甘沉沦 提交于 2019-12-11 23:47:05

问题


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.

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

Here is my environment path

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

回答1:


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

exec 'env'

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

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

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

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.



来源:https://stackoverflow.com/questions/28242749/i-cant-get-any-ruby-gems-to-work-on-cloud9

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!