【问题标题】:I can't run localhost我无法运行本地主机
【发布时间】:2015-12-24 12:00:53
【问题描述】:

所以我用一个简单的方式运行我的本地主机

 rails s

开始还不错:

 => Booting WEBrick
 => Rails 4.1.8 application starting in development on http://0.0.0.0:3000
 => Run 'rails server -h' for more start up options
 => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
 => Ctrl-C to shutdown server

然后出现这条消息:

 A server is already running. Check C:/User/yahshef/sites/game/tmp/pids/server.pids.
 Exiting

然后我检查了“C:/User/yahshef/sites/game/tmp/pids/server.pids”,里面是:

9552

我删除了9552,但是当我运行它时,它像之前的一样开始正常:

 => Booting WEBrick
 => Rails 4.1.8 application starting in development on http://0.0.0.0:3000
 => Run 'rails server -h' for more start up options
 => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
 => Ctrl-C to shutdown server

然后这个有很大的变化,但是还是报错:(,显示是这样的:

Exiting
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.5.3/lib/rack/server.rb:353:in `kill': Invalid argument (Errno::EINVAL)
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.5.3/lib/rack/server.rb:353:in `pidfile_process_status'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.5.3/lib/rack/server.rb:340:in `check_pid!'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.5.3/lib/rack/server.rb:246:in `start'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ralities-4.1.8/lib/rails/commands/server.rb:69:in `server'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ralities-4.1.8/lib/rails/commands/commands_tasks.rb:81:in `block in server'

        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ralities-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `tap'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ralities-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ralities-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ralities-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

有人知道怎么解决吗?我很感激。

编辑

请注意,我在发布此问题之前进行了研究

【问题讨论】:

  • 你有没有做过任何研究来尝试解决这个问题?我在 rails kill': Invalid argument (Errno::EINVAL)` 上进行了谷歌搜索,前几个结果的答案看起来很合理。
  • @BryanOakley 在发布问题之前我做了谷歌研究,但没有一个答案
  • 你做过研究和表明你做过研究是两件不同的事情。向我们展示您为解决此问题所做的尝试。如果您希望获得免费帮助,您也必须愿意付出一点努力。虽然您似乎在浪费时间,但它有助于防止 我们 浪费我们的时间来提供您已经尝试过但不起作用的建议。我们应该如何知道您尝试过什么以及研究过什么?
  • 我发现唯一的方法是实际删除文件,因为这并不重要,我删除它以让我的服务器运行

标签: ruby-on-rails server localhost


【解决方案1】:

打开终端并运行 tasklist 命令。这将显示进程列表,然后运行 ​​taskkill /pid PID(进程的)或简单地粘贴名称。

tasklist
taskkill /pid PID /f

/f 强制终止进程。 http://www.addictivetips.com/windows-tips/kill-processes-from-the-command-prompt-in-windows-7/ https://technet.microsoft.com/en-us/library/bb491009.aspx

这两个链接可以帮助你详细。

【讨论】:

  • 我试过了,但是当我运行 'taskkill /pid PID /f' 时,它给出了一个错误,即找不到进程“PID”
  • Man PID 在这里是一个整数,表示进程 ID。当您运行任务列表时,它会显示带有 PID 的进程列表。检查数字并在下一个命令中将其替换为 PID。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-11
  • 1970-01-01
  • 2018-07-20
  • 2013-07-04
  • 2016-09-16
  • 2018-06-17
相关资源
最近更新 更多