Rails:权限被拒绝-针对"127.0.0.1"的bind(2)端口3000(Errno :: EACCES) [英] Rails: Permission denied - bind(2) for "127.0.0.1" port 3000 (Errno::EACCES)

查看:487
本文介绍了Rails:权限被拒绝-针对"127.0.0.1"的bind(2)端口3000(Errno :: EACCES)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了有关如何开始使用Rails的教程,但最终获得的效果与视频不同.这是我在使用命令rails时得到的消息:

I follow a tutorial on how to get started with rails, but end up with different outcome than the video. Here is the message I get back when using the command rails s:

C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:269:in `initialize': Permission denied - bind(2) for "127.0.0.1" port 3000 (Errno::EACCES)
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:269:in `new'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:269:in `add_tcp_listener'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:263:in `block in add_tcp_listener'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:262:in `each'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:262:in `add_tcp_listener'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:105:in `block in parse'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:88:in `each'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/binder.rb:88:in `parse'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/runner.rb:144:in `load_and_bind'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/single.rb:87:in `run'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/puma/launcher.rb:172:in `run'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/puma-3.8.2/lib/rack/handler/puma.rb:64:in `run'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:296:in `start'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:79:in `start'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in server'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

我在Windows上,并尝试以管理员身份运行命令提示符.结果相同.

I am on Windows, and have tried running the command prompt as admin. Same result.

已解决修改:

technet.microsoft.com/zh-cn/library/ms345310(v = sql.100).aspx并重新启动计算机-

technet.microsoft.com/en-us/library/ms345310(v=sql.100).aspx and restart your pc - Chetan Mehta

推荐答案

对于Ubuntu:

尝试运行sudo rails s 确保您具有sudo权限

Try running sudo rails s Make sure you have sudo permissions

如果端口繁忙,则可以尝试在其他端口上运行服务器.即:

If the port is busy, you can try running server on a different port. i.e.:

rails s -p 3001

如果您使用的是窗口,请尝试以管理员身份运行命令提示符,而不是sudo

If you are using window then instead of sudo try running your command prompt as administrator

这篇关于Rails:权限被拒绝-针对"127.0.0.1"的bind(2)端口3000(Errno :: EACCES)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆