Errno :: ENOENT:没有这样的文件或目录@ rb_sysopen log / production.log(heroku deploy)

时间:2016-07-20 21:15:48

标签: ruby-on-rails heroku

我正在尝试使用命令:

将非主分支部署到heroku
git push heroku staging:master

但发生以下错误。使用master分支,一切正常。

  Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/build_82c61778093d5c199dedf47797381313/log/production.log
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environments/production.rb:85:in `new'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environments/production.rb:85:in `block in <top (required)>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `instance_eval'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `configure'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environments/production.rb:1:in `<top (required)>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `each'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `block in <class:Engine>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `instance_exec'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `run'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:55:in `block in run_initializers'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `each'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `tsort_each_child'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:54:in `run_initializers'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/application.rb:300:in `initialize!'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environment.rb:5:in `<top (required)>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/application.rb:276:in `require_environment!'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/application.rb:389:in `block in run_tasks_blocks'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.2.1/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
remote:        Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/build_82c61778093d5c199dedf47797381313/log/production.log
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environments/production.rb:85:in `new'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environments/production.rb:85:in `block in <top (required)>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `instance_eval'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/railtie.rb:210:in `configure'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environments/production.rb:1:in `<top (required)>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `each'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/engine.rb:593:in `block in <class:Engine>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `instance_exec'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:30:in `run'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:55:in `block in run_initializers'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `each'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:44:in `tsort_each_child'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/initializable.rb:54:in `run_initializers'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/application.rb:300:in `initialize!'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/config/environment.rb:5:in `<top (required)>'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `block in require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232:in `load_dependency'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247:in `require'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/application.rb:276:in `require_environment!'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/railties-4.1.7/lib/rails/application.rb:389:in `block in run_tasks_blocks'
remote:        /tmp/build_82c61778093d5c199dedf47797381313/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.2.1/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
remote:        Tasks: TOP => environment
remote:        (See full trace by running task with --trace)

production.rb第85行:

config.logger = Logger.new(Rails.root.join("log",Rails.env + ".log"), 5, 100*1024*1024)

complete output

production.rb file

更新

嗯,问题出在第85行,但我不知道为什么

有人对此有一些建议吗?

提前致谢

1 个答案:

答案 0 :(得分:4)

听起来已经从git存储库中删除了log目录。也许在你的新分支上,你有git rm的所有内容? Git会自动删除任何没有任何文件的目录,因此通常人们会使用.keep.gitkeep文件来保持log之类的内容不会完全消失。

另外,您应该确保.gitignore不是这个:

/log

但是这个:

/log/*.log