如何使用本地安装的gem执行Ruby程序?

时间:2012-07-02 12:04:51

标签: ruby gem bundler

我已经使用

安装了我的依赖项
bundle package

然后将它们转移到离线服务器并运行:

> 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

但是,无法运行该应用程序:

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>'

我需要为Ruby指定什么才能运行本地安装的gem?

1 个答案:

答案 0 :(得分:6)

您在ruby someprogram.rb命令前面缺少bundle exec