Ruby Rails - Cloud9 - (SocketError)

时间:2016-07-26 17:51:04

标签: ruby-on-rails linux sockets tcp ide

当尝试在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
    

    =&GT;启动WEBrick =&GT; Rails 4.2.5应用程序从http://-0.0.0.0:-8080开发开始 =&GT;运行rails server -h以获取更多启动选项 =&GT; 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:in 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:in foreach&#39;         来自/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/socket.rb:757:in tcp_server_sockets' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/utils.rb:65:in create_listeners&#39;         来自/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:134:in listen' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:115:in初始化&#39;         来自/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:47:in initialize' from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in new&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in run' from /usr/local/rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/server.rb:286:in start&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/server.rb:80:in start' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in阻止服务器&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in tap' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in服务器&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in run_command!' from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in&#39;         来自/ home / ubuntu / jh_projects / mybay2 / bin / rails:9:require' from /home/ubuntu/jh_projects/mybay2/bin/rails:9:in&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in load' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in来电&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in call' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in运行&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in <top (required)>' from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in load&#39;         来自/usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>' from /home/ubuntu/jh_projects/mybay2/bin/spring:13:in要求&#39;         来自/ home / ubuntu / jh_projects / mybay2 / bin / spring:13:<top (required)>' from bin/rails:3:in加载&#39;         来自bin / rails:3:在`&#39;

2 个答案:

答案 0 :(得分:0)

我试图在cloud9上启动我的Sinatra应用程序时遇到了同样的错误。事实证明我正在运行命令:$ bundle exec rackup -p $PORT -o $IP和root用户(su)。尝试在普通用户上运行它。

答案 1 :(得分:0)

您在ip和port参数前加一个破折号。指定的参数值不带破折号。试试:

https://www.googleapis.com/auth/analytics.readonly