我第一次测试 Vagrant 中的共享选项,我正在 Windows 7 Ultimate SP1 32 位 主机上的新 Laravel Homestead VM 配置的 Virtualbox 提供程序上进行测试。
我使用 MINGW32 作为 shell,我禁用了 Windows 防火墙(域、本地和公共(public))以确保这不会影响我的操作。
Vagrant 无法自动找到 HTTP 端口,所以我指定它。
如果我运行以下命令一切顺利:
MINGW32 ~/Vagrant/Homestead ((v6.2.2))
$ vagrant share --http 8000
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.
For more information about the `ngrok` driver, please
refer to the documentation:
https://www.vagrantup.com/docs/share/
==> homestead-7: Detecting network information for machine...
homestead-7: Local machine address: 127.0.0.1
homestead-7:
homestead-7: Note: With the local address (127.0.0.1), Vagrant Share can only
homestead-7: share any ports you have forwarded. Assign an IP or address to your
homestead-7: machine to expose all TCP ports. Consult the documentation
homestead-7: for your provider ('virtualbox') for more information.
homestead-7:
homestead-7: Local HTTP port: 8000
homestead-7: Local HTTPS port: disabled
homestead-7: Port: 2222
homestead-7: Port: 27017
homestead-7: Port: 33060
homestead-7: Port: 44300
homestead-7: Port: 54320
homestead-7: Port: 8000
homestead-7: Port: 8025
==> homestead-7: Creating Vagrant Share session...
==> homestead-7: HTTP URL: http://3bbh648b.ngrok.io
==> homestead-7:
但是下面的命令失败了:
MINGW32 ~/Vagrant/Homestead ((v6.2.2))
$ vagrant share --http 8000 --ssh
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.
For more information about the `ngrok` driver, please
refer to the documentation:
https://www.vagrantup.com/docs/share/
==> homestead-7: Detecting network information for machine...
homestead-7: Local machine address: 127.0.0.1
homestead-7:
homestead-7: Note: With the local address (127.0.0.1), Vagrant Share can only
homestead-7: share any ports you have forwarded. Assign an IP or address to your
homestead-7: machine to expose all TCP ports. Consult the documentation
homestead-7: for your provider ('virtualbox') for more information.
homestead-7:
==> homestead-7: Generating new SSH key...
homestead-7: Please enter a password to encrypt the key:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
homestead-7: Please enter a password to encrypt the key: test
homestead-7: Repeat the password to confirm:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
homestead-7: Repeat the password to confirm: test
homestead-7: Inserting generated SSH key into machine...
homestead-7: Local HTTP port: 8000
homestead-7: Local HTTPS port: disabled
homestead-7: SSH Port: 2222
homestead-7: Port: 2222
homestead-7: Port: 27017
homestead-7: Port: 33060
homestead-7: Port: 44300
homestead-7: Port: 54320
homestead-7: Port: 8000
homestead-7: Port: 8025
==> homestead-7: Creating Vagrant Share session...
C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:61:in `connect_internal': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout (Errno::ETIMEDOUT)
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:139:in `connect'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:636:in `block in tcp'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:231:in `each'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:231:in `foreach'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:626:in `tcp'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:304:in `acquire_port'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:312:in `acquire_port'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2360:in `block in start_share'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:235:in `block in with_target_vms'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:229:in `each'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:229:in `with_target_vms'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2273:in `start_share'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2967:in `execute'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/cli.rb:42:in `execute'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/environment.rb:308:in `cli'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/bin/vagrant:138:in `<main>'
我的 Homestead.yml 文件是:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/web/laravel
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/blog/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
而且我能够 ping 192.168.10.10。
我正在使用 Vagrant version 2.0.0 和 Virtualbox version 5.1.28 r117968 (Qt5.6.2)。
我试图转到文件 C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb 的第 61 行和值 local_addrinfo 为空。我还尝试增加变量 timeout 的值,但没有成功。
你能帮我解决这个问题吗?我不确定它是否依赖于 Windows、MINGW32、Vagrant、Virtualbox 或 Laravel Homestead。
最佳答案
编辑 - vagrant share 的当前版本中似乎存在错误在 Windows 上。 Vagrant 在尝试扫描开放端口以绑定(bind)共享时抛出问题中的错误:在测试每个端口时,Vagrant 尝试打开一个套接字连接,并且由于没有任何东西监听可用端口,Ruby 尽职尽责地抛出有问题的错误。
解决方法 - 我们可以手动调用 ngrok,这是 Vagrant 用来配置共享的工具:
ngrok authtoken <your-token> ngrok tcp 2222 (其中 2222 是您 VM 的转发 SSH 端口)ssh -p <ngrok-port> vagrant@<ngrok-hostname> 为了说明,如果隧道 URL 看起来像 tcp://0.tcp.ngrok.io:55555,我们将使用以下 SSH 命令:
ssh -p 55555 vagrant@0.tcp.ngrok.io
关于windows - Laravel Homestead SSH 远程共享问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46514739/
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
尝试通过RVM将RubyGems升级到版本1.8.10并出现此错误:$rvmrubygemslatestRemovingoldRubygemsfiles...Installingrubygems-1.8.10forruby-1.9.2-p180...ERROR:Errorrunning'GEM_PATH="/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/ruby-1.9.2-p180@global:/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/rub
我正在编写一个gem,我必须在其中fork两个启动两个webrick服务器的进程。我想通过基类的类方法启动这个服务器,因为应该只有这两个服务器在运行,而不是多个。在运行时,我想调用这两个服务器上的一些方法来更改变量。我的问题是,我无法通过基类的类方法访问fork的实例变量。此外,我不能在我的基类中使用线程,因为在幕后我正在使用另一个不是线程安全的库。所以我必须将每个服务器派生到它自己的进程。我用类变量试过了,比如@@server。但是当我试图通过基类访问这个变量时,它是nil。我读到在Ruby中不可能在分支之间共享类变量,对吗?那么,还有其他解决办法吗?我考虑过使用单例,但我不确定这是
我的最终目标是安装当前版本的RubyonRails。我在OSXMountainLion上运行。到目前为止,这是我的过程:已安装的RVM$\curl-Lhttps://get.rvm.io|bash-sstable检查已知(我假设已批准)安装$rvmlistknown我看到当前的稳定版本可用[ruby-]2.0.0[-p247]输入命令安装$rvminstall2.0.0-p247注意:我也试过这些安装命令$rvminstallruby-2.0.0-p247$rvminstallruby=2.0.0-p247我很快就无处可去了。结果:$rvminstall2.0.0-p247Search
由于fast-stemmer的问题,我很难安装我想要的任何rubygem。我把我得到的错误放在下面。Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingfast-stemmer:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcreatingMakefilemake"DESTDIR="cleanmake"DESTDIR=
当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub
这似乎非常适得其反,因为太多的gem会在window上破裂。我一直在处理很多mysql和ruby-mysqlgem问题(gem本身发生段错误,一个名为UnixSocket的类显然在Windows机器上不能正常工作,等等)。我只是在浪费时间吗?我应该转向不同的脚本语言吗? 最佳答案 我在Windows上使用Ruby的经验很少,但是当我开始使用Ruby时,我是在Windows上,我的总体印象是它不是Windows原生系统。因此,在主要使用Windows多年之后,开始使用Ruby促使我切换回原来的系统Unix,这次是Linux。Rub
我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www
我意识到这可能是一个非常基本的问题,但我现在已经花了几天时间回过头来解决这个问题,但出于某种原因,Google就是没有帮助我。(我认为部分问题在于我是一个初学者,我不知道该问什么......)我也看过O'Reilly的RubyCookbook和RailsAPI,但我仍然停留在这个问题上.我找到了一些关于多态关系的信息,但它似乎不是我需要的(尽管如果我错了请告诉我)。我正在尝试调整MichaelHartl'stutorial创建一个包含用户、文章和评论的博客应用程序(不使用脚手架)。我希望评论既属于用户又属于文章。我的主要问题是:我不知道如何将当前文章的ID放入评论Controller。