Ruby on Rails: “no such file or directory” with logger.rb

浪子不回头ぞ 提交于 2019-12-24 10:37:25

问题


I'm attempting to run a RoR app locally for the first time. I've started the server and I get the following error (after WEBrick starts):

C:/Ruby/lib/ruby/1.9.1/logger.rb:599:in `initialize': No such file or directory - /dev/null (Errno::ENOENT)

I try to run rake db:migrate and I get the same error:

    ** Execute environment
    rake aborted!
    No such file or directory - /dev/null
    C:/Ruby/lib/ruby/1.9.1/logger.rb:599:in `initialize'
    C:/Ruby/lib/ruby/1.9.1/logger.rb:599:in `open'
    C:/Ruby/lib/ruby/1.9.1/logger.rb:599:in `create_logfile'
    C:/Ruby/lib/ruby/1.9.1/logger.rb:594:in `open_logfile'
    C:/Ruby/lib/ruby/1.9.1/logger.rb:549:in `initialize'
    C:/Ruby/lib/ruby/1.9.1/logger.rb:314:in `new'
    C:/Ruby/lib/ruby/1.9.1/logger.rb:314:in `initialize'
    C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.0/lib/active_support/core_ext/logger.rb:72:in `initialize'

I'm running on a Windows machine, in case it helps. Does anyone have any idea what's going on here?

> ruby -v
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

> rails -v
Rails 3.2.0

回答1:


/dev/null file is specific to unix, there's no such file on Windows.




回答2:


To add to @farnoy 's answer.

although from the trace it looks like that it might be thrown from rails framework stack or ruby stack. usually it is caused by application developer making wrong assumptions about the environment.

in my case, it is some of the App script file specify '/dev/null' as log file causing the cross platform break.

just grep 'dev/null' in your application folder and modify accordingly.



来源:https://stackoverflow.com/questions/9334138/ruby-on-rails-no-such-file-or-directory-with-logger-rb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!