简体   繁体   English

没有这样的文件或目录@rb_sysopen - tmp/pids/puma.pid

[英]No such file or directory @ rb_sysopen - tmp/pids/puma.pid

I'm trying to start puma, but at the last step it fails like this:我正在尝试启动 puma,但在最后一步它失败了:

16:38:09 web.1  | /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:130:in `initialize': No such file or directory @ rb_sysopen - tmp/pids/puma.pid (Errno::ENOENT)
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:130:in `open'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:130:in `write_pid'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:103:in `write_state'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/single.rb:92:in `run'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/launcher.rb:174:in `run'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/lib/puma/cli.rb:77:in `run'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/gems/puma-3.9.1/bin/puma:10:in `<top (required)>'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/puma:23:in `load'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/puma:23:in `<main>'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15:in `eval'
16:38:09 web.1  |   from /home/ramonpm/.rvm/gems/ruby-2.2.7/bin/ruby_executable_hooks:15:in `<main>'
16:38:09 web.1  | exited with code 1
16:38:09 system | sending SIGTERM to all processes

Couldn't find a solution somewhere else, they are all related to different things.在其他地方找不到解决方案,它们都与不同的事物有关。

Could solve it manually creating the necessary folders, then the server process could create the pid file. 可以手动创建必要的文件夹来解决该问题,然后服务器进程可以创建pid文件。

mkdir tmp
mkdir tmp/pids

You can add that in your config/puma.rb :您可以在config/puma.rb

require "fileutils"
FileUtils.mkdir_p("tmp/pids")

This error happened when I first added puma.rb file by rails app:update to rails 5.2 for a Heroku app.当我第一次通过rails app:update为 Heroku 应用程序添加puma.rb文件到 rails 5.2 时,发生了这个错误。

# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

Resolved by adding tmp/pids/.keep file,通过添加tmp/pids/.keep文件解决,

$ touch tmp/pids/.keep

And updating .gitignore file as follows.并更新.gitignore文件如下。

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM