Sinatra 在服务器上安装时出现以下错误

发布于 2024-12-19 04:29:01 字数 3494 浏览 1 评论 0原文

我正在尝试使用rack & 安装一个简单的hello world 脚本。西纳特拉。

到目前为止,我已经在本地主机上完美运行了一切,但是当我尝试上传到我的服务器时,通过 ssh 运行时出现以下错误:

rackup config.ru

它实际上只是显示“什么都没有”。我必须按 ^+C 才能中止。我尝试了一下

rackup config.ru --debug

,得到了这个:

nil
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- sinatra
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- Win32API
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:62 - no such file to load -- Win32API
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- mongrel
Exception `NoMethodError' at /usr/lib/ruby/1.8/rational.rb:78 - undefined method `gcd' for Rational(1, 2):Rational
Exception `LoadError' at /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/gems.rb:7 - no such file to load -- mongrel_experimental
Exception `Gem::LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247 - Could not find mongrel_experimental (>= 1.1.5) amongst [actionmailer-3.1.3, actionpack-3.1.3, activemodel-3.1.3, activerecord-3.1.3, activeresource-3.1.3, activesupport-3.1.3, arel-2.2.1, builder-3.0.0, bundler-1.0.21, cgi_multipart_eof_fix-2.5.0, coffee-rails-3.1.1, coffee-script-2.2.0, coffee-script-source-1.1.3, daemons-1.1.0, erubis-2.7.0, eventmachine-0.12.10, execjs-1.2.9, fastthread-1.0.7, gem_plugin-0.2.3, hike-1.2.1, i18n-0.6.0, jquery-rails-1.0.19, json-1.6.3, mail-2.3.0, mime-types-1.17.2, mongrel-1.1.5, multi_json-1.0.4, polyglot-0.3.3, rack-1.3.5, rack-cache-1.1, rack-mount-0.8.3, rack-protection-1.1.4, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.1.3, railties-3.1.3, rake-0.9.2.2, rdoc-3.11, rockhands-0.0.6, rubygems-update-1.8.12, sass-3.1.11, sass-rails-3.1.5, sinatra-1.3.1, sprockets-2.0.3, thin-1.3.1, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.31]
#<Rack::ContentLength:0x2b1ed5eebe88
 @app=
  #<Rack::Chunked:0x2b1ed5eebed8
   @app=
    #<Rack::CommonLogger:0x2b1ed5eec130
     @app=
      #<Rack::ShowExceptions:0x2b1ed490bd70
       @app=
        #<Rack::Lint:0x2b1ed490bdc0
         @app=Sinatra::Application,
         @content_length=nil>,
       @template=
        #<ERB:0x2b1ed490bd20
         @filename=nil,
         @safe_level=nil,
         @src=ALL MY HTML IS HERE

如果这有帮助:

* LOCAL GEMS *

actionmailer (3.1.3)
actionpack (3.1.3)
activemodel (3.1.3)
activerecord (3.1.3)
activeresource (3.1.3)
activesupport (3.1.3)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21)
cgi_multipart_eof_fix (2.5.0)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.3)
daemons (1.1.0)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.2.9)
fastthread (1.0.7)
gem_plugin (0.2.3)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.19)
json (1.6.3)
mail (2.3.0)
mime-types (1.17.2)
mongrel (1.1.5)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-protection (1.1.4)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3)
railties (3.1.3)
rake (0.9.2.2)
rdoc (3.11)
rockhands (0.0.6)
rubygems-update (1.8.12)
sass (3.1.11)
sass-rails (3.1.5)
sinatra (1.3.1)
sprockets (2.0.3)
thin (1.3.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)

ruby 1.8.7 (2009-06-08 patchlevel 173) [x86_64-linux]

I'm trying to install a simple hello world script using rack & sinatra.

So far I have got everything working perfectly on localhost, but when I try to upload to my server I get the following error when running via ssh:

rackup config.ru

It really just shows 'nothing'. I have to hit ^+C to abort. I tried

rackup config.ru --debug

I get this:

nil
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- sinatra
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- Win32API
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:62 - no such file to load -- Win32API
Exception `LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- mongrel
Exception `NoMethodError' at /usr/lib/ruby/1.8/rational.rb:78 - undefined method `gcd' for Rational(1, 2):Rational
Exception `LoadError' at /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/gems.rb:7 - no such file to load -- mongrel_experimental
Exception `Gem::LoadError' at /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247 - Could not find mongrel_experimental (>= 1.1.5) amongst [actionmailer-3.1.3, actionpack-3.1.3, activemodel-3.1.3, activerecord-3.1.3, activeresource-3.1.3, activesupport-3.1.3, arel-2.2.1, builder-3.0.0, bundler-1.0.21, cgi_multipart_eof_fix-2.5.0, coffee-rails-3.1.1, coffee-script-2.2.0, coffee-script-source-1.1.3, daemons-1.1.0, erubis-2.7.0, eventmachine-0.12.10, execjs-1.2.9, fastthread-1.0.7, gem_plugin-0.2.3, hike-1.2.1, i18n-0.6.0, jquery-rails-1.0.19, json-1.6.3, mail-2.3.0, mime-types-1.17.2, mongrel-1.1.5, multi_json-1.0.4, polyglot-0.3.3, rack-1.3.5, rack-cache-1.1, rack-mount-0.8.3, rack-protection-1.1.4, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.1.3, railties-3.1.3, rake-0.9.2.2, rdoc-3.11, rockhands-0.0.6, rubygems-update-1.8.12, sass-3.1.11, sass-rails-3.1.5, sinatra-1.3.1, sprockets-2.0.3, thin-1.3.1, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.31]
#<Rack::ContentLength:0x2b1ed5eebe88
 @app=
  #<Rack::Chunked:0x2b1ed5eebed8
   @app=
    #<Rack::CommonLogger:0x2b1ed5eec130
     @app=
      #<Rack::ShowExceptions:0x2b1ed490bd70
       @app=
        #<Rack::Lint:0x2b1ed490bdc0
         @app=Sinatra::Application,
         @content_length=nil>,
       @template=
        #<ERB:0x2b1ed490bd20
         @filename=nil,
         @safe_level=nil,
         @src=ALL MY HTML IS HERE

If this helps:

* LOCAL GEMS *

actionmailer (3.1.3)
actionpack (3.1.3)
activemodel (3.1.3)
activerecord (3.1.3)
activeresource (3.1.3)
activesupport (3.1.3)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21)
cgi_multipart_eof_fix (2.5.0)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.3)
daemons (1.1.0)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.2.9)
fastthread (1.0.7)
gem_plugin (0.2.3)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.19)
json (1.6.3)
mail (2.3.0)
mime-types (1.17.2)
mongrel (1.1.5)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-protection (1.1.4)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3)
railties (3.1.3)
rake (0.9.2.2)
rdoc (3.11)
rockhands (0.0.6)
rubygems-update (1.8.12)
sass (3.1.11)
sass-rails (3.1.5)
sinatra (1.3.1)
sprockets (2.0.3)
thin (1.3.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)

and

ruby 1.8.7 (2009-06-08 patchlevel 173) [x86_64-linux]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

木森分化 2024-12-26 04:29:02

您确定该应用程序无法运行吗?
对我来说,rackup 默认情况下也是静默的,但该应用程序在端口 9292 上运行良好。

刚刚使用最简单的 Rack 应用程序进行了本地测试:

# config.ru

run lambda { |env|
  [
    200, 
    { 'Content-Type'  => 'text/plain' },
    "Hello World"
  ]
}

哦,添加 --debug 也会显示与您的例外相同,但应用程序运行良好。

我相信您的应用程序实际上正在运行,但由于某种原因您无法访问它。也许端口 9292 无法远程访问。

在远程计算机上尝试 telnet localhost 9292 来验证应用程序是否正常工作。你应该看到:

~$ telnet localhost 9292
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Are you sure the app is not working?
For me rackup is also silent by default, but the app works fine on port 9292.

Just tested locally with the simplest ever Rack app:

# config.ru

run lambda { |env|
  [
    200, 
    { 'Content-Type'  => 'text/plain' },
    "Hello World"
  ]
}

Oh and adding --debug also displays the same exceptions as yours, but the app runs fine.

I believe your application is actually working, but you can't access it for some reason. Perhaps port 9292 is not accessible remotely.

Try telnet localhost 9292 on the remote machine to verify the app is working. You should see:

~$ telnet localhost 9292
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
安人多梦 2024-12-26 04:29:02

mongrel_experimental 不是一个单独的 gem 吗?您的堆栈跟踪在第 7 行和第 7 行引用了它。 8,但它没有列在你当地的宝石中。尝试gem install mongrel_experimental

Isn't mongrel_experimental a separate gem? Your stacktrace refers to it on lines 7 & 8, but it's not listed in you local gems. Try gem install mongrel_experimental.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文