[英]Ruby on Rails: Permission denied - bind(2) for “0.0.0.0” port 80 (Errno::EACCES)
[英]Permission denied - bind(2) Errno::EACCES (Ruby on Rails, Webpack on PostgreSQL)
我正在尝试使用 Webpacker 模块和设置为端口 5432(默认)的 PostgreSQL 数据库在 Rails 上使用 Ruby 呈现我的页面(默认) - 我在编译器上来回切换,但最终得到错误访问。 在完成我的防火墙设置并确保我的 PC 接受端口 5432 (TCP) 上的连接后,我的终端中仍然出现 EACCESS:2 错误。
我已经尝试切换到几个不安全的网络,但它仍在发生。
我认为它要么是配置错误的 Webpacker 文件,要么是我的 Database.yml 设置不正确。 我正在使用这些设置运行 RubyMine 内部测试环境。
dev_server:
https: false
host: localhost
port: 5432
public: localhost:5432
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
compile: true
allowedHosts: [
'localhost',
'localhost:3000',
'localhost:5432']
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: '**/node_modules/**'
这是我的错误日志。
C:\Ruby26-x64\bin\ruby.exe C:/Users/Bruger/Desktop/hydac-rails/bin/rails server -b 127.0.0.1 -p 5432 -e development
=> Booting Puma
=> Rails 6.0.2.1 application starting in development
=> Run `rails server --help` for more startup options
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 4.3.1 (ruby 2.6.6-p146), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
Exiting
Traceback (most recent call last):
22: from C:/Users/Bruger/Desktop/hydac-rails/bin/rails:4:in `<main>'
21: from C:/Users/Bruger/Desktop/hydac-rails/bin/rails:4:in `require'
20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in `<top (required)>'
19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/command.rb:46:in `invoke'
18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/command/base.rb:69:in `perform'
17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in `perform'
13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in `tap'
12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:147:in `block in perform'
11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:39:in `start'
10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rack-2.1.2/lib/rack/server.rb:329:in `start'
9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/rack/handler/puma.rb:73:in `run'
8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/launcher.rb:172:in `run'
7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/single.rb:98:in `run'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/runner.rb:161:in `load_and_bind'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb:90:in `parse'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb:90:in `each'
3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb:106:in `block in parse'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb:229:in `add_tcp_listener'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb:229:in `new'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/puma-4.3.1/lib/puma/binder.rb:229:in `initialize': Permission denied - bind(2) for "127.0.0.1" port 5432 (Errno::EACCES)
Process finished with exit code 1
我不完全确定此时出了什么问题。
在我看来,您正试图在与 postgresql 相同的端口上运行 webpack 开发服务器。 我首先会检查您是否在该端口上运行了 postgesql 服务器。 从上面的webpacker.yml
文件中删除对端口 5432 或 'localhost:5432' 等 URL 的所有引用,并恢复默认值,例如:
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: true
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: /node_modules/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.