无法运行 localhost:3000:呈现白色空白页面 [英] Cannot run localhost:3000 : white empty page is rendered

查看:216
本文介绍了无法运行 localhost:3000:呈现白色空白页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Rails 4.2.6 和 Ruby 2.3.0 以及 Puma 3.3.0在过去的几天里,我运行了一些包更新,并且在 rails 之后,相同 URL localhost:3000 的所有浏览器都呈现相同的空白页面.这对于我正在使用的所有 6-7 个应用程序都是一致的.然而,当部署到 Heroku 时,所有这些都在生产"中工作.好像只和我的开发环境有关.

I am using Rails 4.2.6 and Ruby 2.3.0 and Puma 3.3.0 During the last couple days I ran some bundle update and after rails s all browsers for the same URL localhost:3000 are rendering the same blank page. This is consistent for all 6-7 applications I am playing with. However all are working in "production" when deployed to Heroku. Seems to be only a matter related to my dev env.

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

Don't know how to solve this. Any help will be much appreciated. Can't continue development if can't run unit tests on the code I am developing.

但是,当我使用另一个端口时一切正常.例如,当使用命令 rails s -p 3001 或端口 3002 启动应用程序服务器时,我可以使用 URL localhost:3001 或 localhost:3002 在任何浏览器中运行应用程序.

However all works well when I am using another port. For example when starting the app server with the command rails s -p 3001 or port 3002 I have no problems to run the apps in any browser using the URL localhost:3001 or localhost:3002.

我的 3000 端口或 Puma 或两者有什么问题?

What is wrong with my 3000 port or Puma or both?

推荐答案

由于停止 Puma 时的错误,它可能发生在本地的 dev 而永远不会发生在prod"即 Heroku.有时某些进程没有被杀死是因为:

It may happen in locally in dev and never in "prod" i.e. Heroku due to a bug when stopping Puma. Some times some processes are not killed due to:

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

使用端口3000列出所有剩余的进程.

lists all remaining processes using port 3000.

levi-test-01 liviu-mac $ kill -9 PID

解决问题.

这篇关于无法运行 localhost:3000:呈现白色空白页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆