簡體   English   中英

權限被拒絕 - bind(2) Errno::EACCES(Ruby on Rails,PostgreSQL 上的 Webpack)

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM