gpt4 book ai didi

ruby-on-rails - Rails-教程第一章 : rails server isn't working on Cloud9

转载 作者:行者123 更新时间:2023-12-03 00:53:30 26 4
gpt4 key购买 nike

https://www.railstutorial.org/book/beginning#sec-rails_server

我已经到了这一步,并且我使用的是cloud9环境。然而,当我按照该教程中的 list 1.7 运行服务器时,出现以下错误:

myname@rails-tutorial:~/workspace/hello_app $ rails server -p $PORT -b $IP
=> Booting WEBrick
=> Rails 4.2.0.beta2 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-10-30 21:44:22] INFO WEBrick 1.3.1
[2014-10-30 21:44:22] INFO ruby 2.1.1 (2014-02-24) [x86_64-linux]
Exiting /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:206:in `bind': Address already in use - bind(2) for 0.0.0.0:8080 (Errno::EADDRINUSE)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:206:in `listen'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:461:in `block in tcp_server_sockets'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:232:in `each'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:232:in `foreach'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:459:in `tcp_server_sockets'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/utils.rb:75:in `create_listeners'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:132:in `listen'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:113:in `initialize'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:45:in `initialize'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:32:in `new'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:32:in `run'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/rack-1.6.0.beta/lib/rack/server.rb:288:in `start'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/railties-4.2.0.beta2/lib/rails/commands/server.rb:80:in `start'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
from /home/ubuntu/workspace/hello_app/bin/rails:8:in `require'
from /home/ubuntu/workspace/hello_app/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.1.1@rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/ubuntu/workspace/hello_app/bin/spring:16:in `require'
from /home/ubuntu/workspace/hello_app/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

我尝试指定不同的端口,但这不起作用,cloud9 环境建议我应该使用 $PORT 变量。

错误“地址已在使用 - bind(2) for 0.0.0.0:8080 (Errno::EADDRINUSE)”意味着我已经有一个 Rails 服务器正在运行,但我没有。我不太确定在这里该怎么做,并且本教程没有建议任何解决此问题的方法。

最佳答案

我了解到您可以使用命令 killall ruby停止任何对我有帮助的 ruby​​ 进程,因为我错误地运行了 rails server -b $IP -p $PORT命令位于 ~/workspace教程中的级别。我在can't open rails server中找到了答案

关于ruby-on-rails - Rails-教程第一章 : rails server isn't working on Cloud9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26663967/

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