我有两个不同的项目-一个是出于练习目的而创建的,另一个是真实的项目。
我正在使用RVM设置版本,它们都在2.6.0和rails 5.2.3上运行
我的实践项目在localhost:3000上启动正常。但是在运行应用程序时(在资源管理器/ netstat中签入)我看不到它在任何地方或以任何方式被使用
但是,当我尝试启动第二个应用程序时,却“监听:地址已在使用中-listen(2)并且rails关闭。
我试图重新启动终端机/我的计算机,只是为了确保端口3000上没有任何运行,而且我终生无法理解为什么它无法正常工作。
有人经历过类似的事情吗?我显然已经尝试过在这里寻找类似的问题,但是大多数答案都与终止当前在3000上正在运行的计算机有关,但我无法确认是否有任何故障。
已更新: 好的,所以当我启动抱怨端口正在使用的应用程序时,我得到以下信息:
/usr/share/rvm/rubies/ruby-2.6.0/bin/ruby: warning: shebang line ending with \r may cause problems
在尝试启动之后,它说它正在监听tcp://127.0.0.1:3000,这很好而且很花哨,但是随后它停止了,这是跟踪信息:
Traceback (most recent call last):
19: from bin/rails:4:in `<main>'
18: from bin/rails:4:in `require'
17: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
16: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
15: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
14: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
13: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
12: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
11: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `perform'
10: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `tap'
9: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:147:in `block in perform'
8: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:53:in `start'
7: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:297:in `start'
6: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/rack/handler/puma.rb:73:in `run'
5: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/launcher.rb:172:in `run'
4: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/cluster.rb:463:in `run'
3: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/runner.rb:82:in `start_control'
2: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/forwardable.rb:230:in `add_unix_listener'
1: from /home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:328:in `add_unix_listener'
/home/sorgmantel/.rvm/gems/ruby-2.6.0/gems/puma-4.3.0/lib/puma/binder.rb:328:in `listen': Address already in use - listen(2) (Errno::EADDRINUSE)
Breadcrumb Mongo query succeeded meta_data collection:Array has been dropped for having an invalid data type
是否可能与文件来源有关?我的项目运行良好,因为它是用Windows编写的,但是我不能运行用MAC编写的另一行,因为它的行尾和所有行都不同。我听说Ruby在Windows机器上运行时可能很敏感。
答案 0 :(得分:0)
显然,这是由
引起的 activate_control_app
在我的puma.rb文件中。当我评论它时,该应用程序正常启动。