gpt4 book ai didi

Ruby/Sinatra 应用程序(文件)不运行(启动)

转载 作者:数据小太阳 更新时间:2023-10-29 07:53:11 27 4
gpt4 key购买 nike

我正在使用:ruby-1.9.3-p392 和 sinatra-1.4.3。

当我运行我的文件时,我得到了这个错误:

/home/belka/.rvm/gems/ruby-1.9.3-p392@Rails3.2.13/gems/sinatra-1.4.3/lib/sinatra/base.rb:1408:in `run!': undefined method `run' for HTTP:Module (NoMethodError)

from /home/belka/.rvm/gems/ruby-1.9.3-p392@Rails3.2.13/gems/sinatra-1.4.3/lib/sinatra/main.rb:25:in `block in <module:Sinatra>'

我的代码是sinatra新手最简单的代码(hello.rb):

require 'rubygems'
require 'sinatra'

get '/' do
'Hello World!'
end

最佳答案

我只需要添加这段代码,我的 sinatra 应用程序现在就可以运行了:

set :server, 'webrick'

关于Ruby/Sinatra 应用程序(文件)不运行(启动),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17506036/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com