2016-09-15 114 views
-1

我一直在嘗試使用命令軌服務器 但運行我的Rails應用程序最近,這種錯誤已經上來了:Ruby on Rails的服務器沒有啓動

的Mac-的MacBook-PRO:jobsboard MAC $軌服務器 =>引導彪馬 => Rails的5.0.0.1應用開發開始於http://localhost:3000 =>運行rails server -h更多的啓動選項Puma在單一模式下啓動... *版本3.6.0(紅寶石2.3.0-P0 ),代號:Sleepy Sunday Serenity *最少線程:5,最多線程:5 *環境:developmen t *聽取tcp:// localhost:3000正在退出/Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in initialize': Address already in use - bind(2) for "::1" port 3000 (Errno::EADDRINUSE) from /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in 新「 /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:266:in add_tcp_listener' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:260:in block in add_tcp_listener'from /Users/mac/.rvm/gems/ruby​​-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259: each' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:259:in add_tcp_listener'from /Users/mac/.rvm/gems/ruby- 2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:102:在 block in parse' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/binder.rb:85:in 每個'從 /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6 .0/lib/puma/binder.rb:85:在 parse' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/runner.rb:133:in load_and_bind'從 /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/single.rb:85:in run' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:in run'from /Users/mac/.rvm/ gems/ruby​​-2.3.0/gems/puma-3.6.0/lib/rack/handler/puma.rb:51:in run' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/server.rb:296:in start'from /Users/mac/.rvm/gems/ruby-2.3.0 /gems/railties-5.0.0.1/lib/rails/commands/server.rb:79:in start' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in block in server'from /Users/mac/.rvm/gems/ruby-2.3.0/gems/railties- 5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in tap' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in server'from /Users/mac/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/命令/ commands_tasks.rb:49:在run_command!' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in 'from/Users/mac/Documents/Projects/Web 開發/ Ruby On Rails/Jobs Board/jobsboard/bin/rail s:9: require' from /Users/mac/Documents/Projects/Web Development/Ruby On Rails/Jobs Board/jobsboard/bin/rails:9:in'from /Users/mac/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in load' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in call 'from /Users/mac/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in call' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in run'from /Users/mac /.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in <top (required)>' from /Users/mac/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in 加載'from /Users/mac/.rvm/gems/ruby-2.3.0/gems /spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>' from /Users/mac/Documents/Projects/Web Development/Ruby On Rails/Jobs Board/jobsboard/bin/spring:13:in 需要'from/Users/mac/Documents/Projects/Web Development/Ruby On Rails/Jobs Board/jobsboard/bin/spring:13 :在<top (required)>' from bin/rails:3:in加載'從bin/rails:3:in `」

我可以解決此通過指定不同的端口 - 即使用命令‘

軌服務器-p 4000

’,但我想用我的舊部署它的方式。我該如何解決它?

附:我是Rails的新手,所以請給出簡單的說明。 :p讚賞很多傢伙!謝謝!

增加:

上次登錄:週四09月15日13點55分52秒上ttys000的Mac-的MacBook-PRO:的Ruby on Rails的 MAC $的ps aux | grep rails mac 1040 0.0 0.0 2445080 800 s003 S + 2:02 PM 0:00.00 grep rails mac
1020 0.0 0.0 2471272 3052 s000 S + 2:02 PM 0:00.01 /Users/mac/.rvm/gems/ruby-2.3。 0/gems/rb-fsevent-0.9.7/bin/fsevent_watch --latency 0.1 /Users/mac/.rvm/gems/ruby-2.3.0/gems/jquery-rails-4.2.1 mac 1019 0.0 0.0 2462056 3032 s000 S + 2:02 PM
0:00.01 /Users/mac/.rvm/gems/ruby-2.3.0/gems/rb-fsevent-0.9.7/bin/fsevent_watch --latency 0.1/Users/mac /.rvm/gems/ruby-2.3.0/gems/coffee-rails-4.2.1的Mac-的MacBook-PRO:Ruby on Rails的MAC $

回答

3

這意味着端口3000不是免費的。您項目的另一個實例已經在使用它。 所以,找到進程它通過以下命令:

lsof -i :3000 

&通過以下殺死進程:

kill -9 processid 

您也可以從你的applcation的臨時文件夾中刪除的進程ID。
或者,您可以通過命令啓動其他端口上的應用程序rails s -p 3001

1

打開終端或的iTerm和假設ÿ你已經在你的項目目錄中。

檢查進程的PID(ES)

lsof -wni tcp:3000 

,如果他們存在,然後殺掉進程(ES),按類型這對終端

kill -9 PID 
0

「您有試過再次將其關閉?」

很可能您的應用程序的某個版本已在後臺運行。在活動監視器一看就看你是否能看到它,或者如果你確信你的終端福,你可以嘗試

ps aux | grep rails 

,看看它是否顯示在那裏。然後使用kill xxxx與進程ID結束它應該再次釋放您的端口3000