`require':运行Sinatra应用程序时没有加载这样的文件 - sinatra / base(LoadError)(resque-web)

时间:2012-12-31 08:19:41

标签: ruby-on-rails ruby ruby-on-rails-3 sinatra resque

我正在运行Resque的PHP版本,并希望使用Resque的Ruby版本附带的Sinatra前端应用程序。 (https://github.com/defunkt/resque-web)

问题:在我的Ubuntu框中,我安装了Ruby,Gems和Sinatra。当我尝试启动server.rb时,出现错误,如下所示。

几乎没有Ruby经验,任何帮助这个应用程序工作的帮助都会很棒:)

错误

server.rb:1:in `require': no such file to load -- sinatra/base (LoadError)
    from server.rb:1

我做了什么

git clone https://github.com/defunkt/resque-web.git
sudo apt-get install ruby-full build-essential
sudo apt-get install rubygems
gem install sinatra
cd resque-web
ruby server.rb

红宝石

ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

尝试2

它可能会变得更糟......

已添加到server.rb

的顶部
require 'rubygems'

错误

/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- resque (LoadError)

尝试3

gem install resque
ruby server.rb

错误

[WARNING] MultiJson is using the default adapter (ok_json). We recommend loading a different JSON library to improve performance.
/var/lib/gems/1.8/gems/resque-1.23.0/lib/resque/helpers.rb:6: Please install the yajl-ruby or json gem (RuntimeError)
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /var/lib/gems/1.8/gems/resque-1.23.0/lib/resque.rb:10
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:59:in `require'
        from server.rb:4

做的:

gem install json gem
ruby server.rb

错误

:public is no longer used to avoid overloading Module#public, use :public_folder instead from server.rb:13

尝试4

已更改

    set :public, "#{dir}/server/public"

    set :public_folder, "#{dir}/server/public"

现在当我ruby server.rb时,没有任何反应,我回到了外壳......

1 个答案:

答案 0 :(得分:1)

使用gems安装Resque,gem install resque,然后从命令行运行resque-web。参考:github.com/defunkt/resque