美文网首页
和古怪的Larvel环境作斗争!

和古怪的Larvel环境作斗争!

作者: 孔祥子看天下 | 来源:发表于2018-03-08 18:08 被阅读45次

前言

好久没用homestead环境了,一启动遇到如下问题

Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Setting the name of the VM: homestead-7
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
homestead-7: Adapter 1: nat
homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
homestead-7: 80 (guest) => 8000 (host) (adapter 1)
homestead-7: 443 (guest) => 44300 (host) (adapter 1)
homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

问题分析

明显的是超时

回想我中间做了啥,对 了,是从新生成了ssh-key!!!!!

但是,我删除了~/.vagrant/下面的private key 就是我自己电脑的~/.ssh下面的!!!!

中间还尝试过重新更新virtualbox的镜像!

包括,virtualbox中设置总要点击选中 『网络』接入网线,这个选项!!!

无济于事!!!

最后,无意运行了一行命令,打开了思路

vagrant status 如下


图片.png

问题来了,我启动 VM的名字是homestead-7,为何这里的status显示的是default,而这个default 确实是没有打开的啊!!!!

问题应该就是在这里了,就是我homestead up 启动但是 homestead-7虚拟机,而homestead ssh连接的时候呢,却默认连接的是 名字为default的VM所以,连接不上也很正常啊!!!!!

解决

  • 删除~/.vagrant文件
  • homestead halt,停止正在运行的虚拟机
  • 重新homestead up 启动

注意

  • 如果你留意你会发现,homestead-7和default这两个虚拟机啥关系呢?这里的关系是,你使用homestead命令启动就是,否则就是default,defalut的端口映射默认很少
  • 开发laravel的时候,一定要用homestead这个命令,方面的地方在于,无论你在哪个地方,都会定位到同一个文件夹执行homestead。这样,得到的环境才一样!

我的理解,你再某一个文件夹下面操作vagrant 配置会和这个文件夹有些关系。

不对多多指教!!!!

相关文章

  • 和古怪的Larvel环境作斗争!

    前言 好久没用homestead环境了,一启动遇到如下问题 Bringing machine 'homestead...

  • Laravel引入vue

    本文建立在该环境上。Laravel默认是支持vue的,安装了Larvel后,目录下已经有了vue的package....

  • larvel Validator

    Validator验证 控制器验证 Validator门面

  • Laravel 学习笔记 - 表单篇

    Controller Controller 之 Rquest Larvel中的请求使用的是symfony/http...

  • 小古怪和老古怪

    女儿发信息说,宝今天睡的好,到现在都没起。说凌晨一点,哼哼唧唧的,就起床给他换块尿片,他边换边拉,还撒了泡尿,然后...

  • Larvel的测试组件

    laravel的测试组件这一块是laravel这个框架重要的特性之一,一个有健壮性的项目,一个值得维护的项目,测试...

  • 未来时代

    人类自古以来便于自然作斗争,在恶劣的环境当中,随时面临着来自其他种群,和外界环境的侵害,在面对死亡威胁时,学会了使...

  • 当我们解决温饱时,美国人的赛博朋克已登峰造极

    当我们还在努力解决温饱,准备奔小康的时候。美国人民已经和俄罗斯作斗争,和外星人作斗争,和机器人作斗争很多年了。不过...

  • larvel官方推荐环境安装之安装 Homestead Vagr

    问题:在cmd执行 vagrant box add laravel/homestead 遇到异常

  • 和食欲作斗争

    反复的减重已经有四年多了。结果却不甚乐观,体重依然还在原点。失败了,那你自己找原因啊。 我痛苦的发现了自己这无法控...

网友评论

      本文标题:和古怪的Larvel环境作斗争!

      本文链接:https://www.haomeiwen.com/subject/ipwyfftx.html