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



我是ruby on rails的新手。我成功地安装了它,但当我键入rails的命令时,我得到了

/home/essedden/Desktop/myrails/mynewproject/bin/spring:11:in <top (required)>': undefined method path_separator'for Gem:Module('NoMethodError'(从料箱/导轨:3:在load' from bin/rails:3:in'中我在安装mysql-libary后得到了这个错误。我怀疑他们可能有关联我尝试过谷歌搜索,但没有找到足够的回复来解决这个问题请帮忙吗??

当我试图从以下位置运行博客示例时,我得到了完全相同的错误:http://guides.rubyonrails.org/getting_started.html

我的垃圾箱/轨道文件是:

#!/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/rrails文件在APP_path 中仍然有类似的路径引用

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

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

相关内容

最新更新