Ruby Rails - Cloud9 - (SocketError)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ruby Rails - Cloud9 - (SocketError)相关的知识,希望对你有一定的参考价值。

当试图在C9.io中启动我的Rails应用程序时,我看到下面的套接字错误。我不确定如何纠正这个问题。有任何想法吗?

  • ruby 2.3.0p0(2015-12-25修订版53290)[x86_64-linux]
  • Rails 4.2.5
  • Cloud9 IDE blacknight659:~/jh_projects/mybay2 $ rails s -b -$IP -p -$PORT =>启动WEBrick => Rails 4.2.5应用程序从http://-0.0.0.0:-8080开发开始=>运行rails server -h获取更多启动选项=> Ctrl-C关闭服务器[2016-07-26 17:43:06] INFO WEBrick 1.3.1 [ 2016-07-26 17:43:06] INFO ruby​​ 2.3.0(2015-12-25)[x86_64-linux]退出/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3。 0 / socket.rb:231:来自/ usr / local /来自/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:757:来自/ usr / local /的getaddrinfo': getaddrinfo: Servname not supported for ai_socktype (SocketError) from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:231:increate_listeners rvm / rubies / ruby​​-2.3.0 / lib / ruby​​ / 2.3.0 / webrick / server.rb:134:in tcp_server_sockets' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/utils.rb:65:ininitialize'from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3 .0 / webrick / httpserver.rb:47:in listen' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:115:innew'来自/usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:在initialize' from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:instart'来自/usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/server.rb:80:in run' from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/server.rb:286:inblock in server'from / usr / local / rvm / gems / ruby​​-2.3.0 / gems / railties-4.2.5 / lib / rails / commands / commands_tasks.rb:75:in start' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:inserver'来自/ usr / local / rvm / ge ms / ruby​​-2.3.0 / gems / railties-4.2.5 / lib / rails / commands / commands_tasks.rb:39:in tap' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in'from / home / ubuntu / jh_projects / mybay2 / bin / rails:9:in run_command!' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in'来自/usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in require' from /home/ubuntu/jh_projects/mybay2/bin/rails:9:incall'来自/ usr / local / rvm / gems / ruby -2.3.0 / gems / spring-1.7.2 / lib / spring / client / command.rb:7:in load' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:inrun'from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7。 2 / bin / spring:49:在call' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:inload'来自/usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:inrequire'来自/ home / ubuntu / jh_projects / mybay2 / bin / spring:13:在<top (required)>' from /home/ubuntu/jh_projects/mybay2/bin/spring:13:inload'来自bin / rails:3:in''
答案

尝试在cloud9上启动我的Sinatra应用程序时出现了同样的错误。事实证明我正在运行命令:<top (required)>' from bin/rails:3:in和root用户(su)。尝试在普通用户上运行它。

以上是关于Ruby Rails - Cloud9 - (SocketError)的主要内容,如果未能解决你的问题,请参考以下文章

text Cloud9上的Rails + PostgreSQL

Cloud9 警告我应该忽略吗?

在 Rails 上使用唯一 id ruby​​ 映射日期

Ruby on Rails 表单中的 select 和 onChange

我可以在没有 Ruby 的情况下生成 Rails SECRET_KEY_BASE 吗?

脚手架后无法迁移 psql 数据库 - Cloud9