gpt4 book ai didi

ruby-on-rails - 无法运行localhost :3000 : white empty page is rendered

转载 作者:行者123 更新时间:2023-12-04 06:15:49 30 4
gpt4 key购买 nike

我正在使用Rails 4.2.6和Ruby 2.3.0和Puma 3.3.0
在过去的几天中,我运行了一些软件包更新,并且在Rails的所有URL为localhost:3000的浏览器呈现相同的空白页之后。
这对于我正在使用的所有6-7个应用程序都是一致的。
但是,当部署到Heroku时,所有人都在“生产”中工作。
似乎只是与我的开发环境有关的问题。

不知道该怎么解决。任何帮助都感激不尽。如果无法对正在开发的代码运行单元测试,则无法继续开发。

但是,当我使用其他端口时,一切正常。例如,当使用命令rails s -p 3001或端口3002启动应用程序服务器时,使用URL localhost:3001或localhost:3002在任何浏览器中运行应用程序都没有问题。

我的3000端口或Puma或两者都出了什么问题?

最佳答案

由于可能会在停止Puma时出现错误,因此它可能会在开发人员本地发生,而不会在“产品”中发生,即Heroku。有时某些进程由于以下原因而无法终止:

levi-test-01 liviu-mac $ rails s
=> Booting Puma
=> 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
[4589] Puma starting in cluster mode...
[4589] * Version 3.3.0 (ruby 2.3.0-p0), codename: Jovial Platypus
[4589] * Min threads: 5, max threads: 5
[4589] * Environment: development
[4589] * Process workers: 2
[4589] * Preloading application
[4589] * Listening on tcp://localhost:3000
[4589] Use Ctrl-C to stop
[4589] - Worker 1 (pid: 4603) booted, phase: 0
[4589] - Worker 0 (pid: 4602) booted, phase: 0
^C[4589] - Gracefully shutting down workers...
/Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:355:in `delete': No such file or directory @ unlink_internal - /Users/liviu-mac/ror/levi-test-01/tmp/pids/server.pid (Errno::ENOENT)
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:355:in `block in write_pid'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/puma/cluster.rb:120:in `fork'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/puma/cluster.rb:120:in `block in spawn_workers'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/puma/cluster.rb:116:in `times'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/puma/cluster.rb:116:in `spawn_workers'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/puma/cluster.rb:418:in `run'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/puma/launcher.rb:172:in `run'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.3.0/lib/rack/handler/puma.rb:51:in `run'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/server.rb:80:in `start'
from /Users/liviu-mac/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'

运行这样的命令:
levi-test-01 liviu-mac $ lsof -i :3000

使用 port 3000列出所有剩余的进程。

像这样的命令
levi-test-01 liviu-mac $ kill -9 PID

解决了问题。

关于ruby-on-rails - 无法运行localhost :3000 : white empty page is rendered,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36479060/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com