问题
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