How to execute Ruby program with locally installed gems?

六月ゝ 毕业季﹏ 提交于 2019-12-10 19:00:54

问题


I have installed my dependencies using

bundle package

Then transferred them to the offline server and running:

> bundle install --local
Using mime-types (1.19)
Using rest-client (1.6.7)
Using trollop (1.16.2)
Using bundler (1.1.4)
Your bundle is complete! It was installed into ./vendor/bundle

However, it is not possible to run the application:

ruby someprogram.rb
/usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- trollop (LoadError)
        from /usr/local/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from someprogram.rb:2:in `<main>'

What do I need to specify to Ruby to be able to run locally installed gems?


回答1:


You're missing bundle exec in front of your ruby someprogram.rb command.



来源:https://stackoverflow.com/questions/11293339/how-to-execute-ruby-program-with-locally-installed-gems

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