运行错误" rails s"在ruby中获取(NoMethodError)

时间:2016-03-08 04:05:37

标签: ruby

我是rails上的ruby新手。我成功安装了它但是当我输入rails s命令时我得到了

/ home / banished / Desktop / myrails / mynewproject / bin / spring:11:<top (required)>': undefined method path_separator&#39;对于Gem:模块(&#39; NoMethodError&#39;)     来自bin / rails:3:load' from bin/rails:3:in&#39; 我在安装mysql libary后得到了这个错误。我怀疑他们可能是相关的 我试过谷歌搜索,但我没有找到足够的答案来解决这个问题 请任何帮助??

1 个答案:

答案 0 :(得分:2)

当我尝试从http://guides.rubyonrails.org/getting_started.html

运行博客示例时,我得到完全相同的错误

我的bin / rails文件是:

#!/usr/bin/env ruby
begin
  load File.expand_path('../spring', __FILE__)
rescue LoadError => e
  raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

我认为它应该指向同一目录中的spring文件,所以我改变了它。

<   load File.expand_path('./spring', __FILE__)
---
>   load File.expand_path('../spring', __FILE__)

之后我设法启动服务器

haahu@haahudev:~/workspace/rails/blog$ bin/rails server
=> Booting WEBrick
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-03-15 08:45:34] INFO  WEBrick 1.3.1
[2016-03-15 08:45:34] INFO  ruby 1.9.3 (2013-11-22) [x86_64-linux]
[2016-03-15 08:45:34] INFO  WEBrick::HTTPServer#start: pid=2977 port=3000


Started GET "/" for 127.0.0.1 at 2016-03-15 08:45:52 +0200
Processing by Rails::WelcomeController#index as HTML
  Rendered /var/lib/gems/1.9.1/gems/railties-4.2.6/lib/rails/templates/rails/welcome/index.html.erb (63.1ms)
Completed 200 OK in 166ms (Views: 84.4ms | ActiveRecord: 0.0ms)
[2016-03-15 08:45:54] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

可能这样修复是不够的,因为我的bin / rails文件在APP_PATH中仍然有类似的路径引用

APP_PATH = File.expand_path('../../config/application', __FILE__)

但我认为这将是一种新的错误信息: - )