[英]Laravel/Homestead vagrant box disapeared from system
I got a php project which is already done and for starters I have to put it up on a server (planning to use Heroku). 我有一个已经完成的php项目,对于初学者来说,我必须将其放在服务器上(计划使用Heroku)。 I am new to PHP virtual boxes, Laravel, etc. The person who made the project recommended to use Laravel so I started to get things going that way.
我是PHP虚拟盒子,Laravel等的新手。创建该项目的人建议使用Laravel,因此我开始朝着这种方向发展。 I am running on Windows 10 and using cmder as my terminal.
我在Windows 10上运行,并使用cmder作为终端。
Then using commander I added the Laravel/Homestead box by doing: 然后使用指挥官,通过执行以下操作添加了Laravel / Homestead框:
vagrant box add laravel/homestead
in the folder c:\\Users\\Jacky\\vagrant\\ubuntu (At least I think that is where I added it) 在文件夹c:\\ Users \\ Jacky \\ vagrant \\ ubuntu中(至少我认为这是我添加的位置)
vagrant init laravel/homestead
vagrant init laravel/homestead
I made the following folder map 我做了以下文件夹图
- map: C:\Jack\myapp\public
to: /home/vagrant/myapp
and the following site map 和以下站点地图
- map: myapp.test
to: /home/vagrant/myapp/public
I am a bit confused with the directory structure of this whole thing and not sure if I was supposed to put the myapp directory inside c:\\Jack\\Homestead\\myapp or if just doing it like i did in c:\\Jack\\myapp is fine. 我对整个事情的目录结构有些困惑,不确定我是否应该将myapp目录放在c:\\ Jack \\ Homestead \\ myapp中,还是像在c:\\ Jack \\ myapp中那样做精细。
Anyways that still worked and I could see it in my web browser. 无论如何仍然可以正常工作,我可以在Web浏览器中看到它。 So far all was good.
到目前为止,一切都很好。
Then the project instructions told me to do the following 然后项目说明告诉我要执行以下操作
At this point I got an error that the Symlink could not be created, so I googled and found in Stack Overflow to restart as admin. 此时,我收到一个无法创建符号链接的错误,因此我用Google搜索并在Stack Overflow中找到以admin身份重新启动。 I ran cmder as admin and have been having a heart attack for the last 30 minutes since it told me I had to vagrant up and when I did so it couldnt find my box and even doing
vagrant box list
我以管理员身份运行cmder,并且在过去30分钟内一直心脏病发作,因为它告诉我必须流浪,当我这样做时,它找不到我的盒子,甚至找不到
vagrant box list
I would get no results and it wanted to redownload which takes over 3 hours. 我没有结果,它想重新下载,这需要3个小时以上。 I just restarted without admin and I do find that my Laravel/Homestead box is listed so I assume it was installed for my user and not admin so I guess I cant run cmder as admin.
我只是在没有管理员的情况下重新启动,但确实找到了我的Laravel / Homestead框,因此我认为它是为我的用户而非管理员安装的,因此我想我不能以admin身份运行cmder。
So now I am trying to connect again, I am not sure in which folder I should be running the vagrant commands but I only seem to have a VagrantFile in my C:\\Jack\\Homestead folder so if I run a vagrant command anywhere else it gives me an error that a vagrant environment is required, etc. 所以现在我尝试再次连接,我不确定我应该在哪个文件夹中运行vagrant命令,但我的C:\\ Jack \\ Homestead文件夹中似乎只有VagrantFile,所以如果我在其他任何地方运行vagrant命令,给我一个错误,提示需要一个无所事事的环境,等等。
So I tried the following inside my homestead folder: 因此,我在homestead文件夹中尝试了以下操作:
vagrant ssh
- I get: vagrant ssh
我得到:
VM must be running to open SSH connection.
VM必须正在运行才能打开SSH连接。 Run `vagrant up to start the virtual machine.
运行`vagrant up'启动虚拟机。
(In my VirtualBox Manager i see my homestead-7 VM running though) (在我的VirtualBox Manager中,我看到了我的homestead-7 VM正在运行)
vagrant up
- I get: vagrant up
-我得到:
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... A VirtualBox machine with the name 'homestead-7' already exists. Please use another name or delete the machine with the existing name, and try again.
vagrant ssh 'homestead-7'
I also get vagrant ssh 'homestead-7'
我也得到
VM must be running to open SSH connection.
VM必须正在运行才能打开SSH连接。 Run
vagrant up
to start the virtual machine.运行
vagrant up
启动虚拟机。
And the problem is once I do connect I assume I will still have the same problem running: 问题是,一旦我完成连接,我就认为我仍然会遇到相同的问题:
php artisan storage:link
So my questions are as follows: 所以我的问题如下:
C:\\Jack\\myapp
or am I supposed to put it in C:\\Jack\\Homestead\\myapp
C:\\Jack\\myapp
还是应该将其放在C:\\Jack\\Homestead\\myapp
vagrant ssh
and vagrant up
vagrant ssh
和vagrant up
一样 vagrant ssh
and vagrant up
vagrant ssh
和vagrant up
时遇到这些错误,如何再次连接 php artisan storage:link
since to run as administrator seems to not work what do I do? php artisan storage:link
会遇到相同的错误,因为以管理员身份运行似乎不起作用,我该怎么办? git init
and heroku create
inside the myapp folder is this correct? git init
和heroku create
正确吗? 1) I always keep my apps folders outside of the Homestead folder. 1)我始终将我的apps文件夹放在Homestead文件夹之外。 Your Homestead folder contains a git project, so if you put your apps inside you should include the folder in the .gitignore file.
您的Homestead文件夹包含一个git项目,因此,如果您将应用程序放入其中,则应在.gitignore文件中包含该文件夹。 I think it's easier if you just put your apps elsewhere.
我认为将应用程序放在其他地方会更容易。
2) Vagrantfile is suposed to only be inside of your Homestead folder ( c:\\Jack\\Homestead). 2)Vagrantfile应该仅位于您的Homestead文件夹内(c:\\ Jack \\ Homestead)。 You should run all your vagrant commands inside the Homestead folder.
您应该在Homestead文件夹中运行所有无业游民的命令。
3) I used to get this error when I tried to run 'vagrant up' to a project that used the same box name 'homestead-7'. 3)当我尝试对使用相同框名“ homestead-7”的项目运行“ vagrant up”时,我经常遇到此错误。 If you have version control, check if the file c:\\Jack\\Homestead\\.vagrant\\machines\\homestead-7\\virtualbox\\id has been changed.
如果您具有版本控制,请检查文件c:\\ Jack \\ Homestead \\ .vagrant \\ machines \\ homestead-7 \\ virtualbox \\ id是否已更改。 If so, try restoring the old value and running 'vagrant up' again.
如果是这样,请尝试恢复旧值并再次运行“无用”。
4) You are running in a windows environment, right? 4)您正在Windows环境中运行,对吗? Windows can be a little temperamental with symlinks inside vagrant.
Windows在流浪汉中带有符号链接可能会有点气质。 You'll get the same problem if you try to npm install something.
如果尝试npm安装某些内容,则会遇到相同的问题。 What I do to solve this is to run npm (and php artisan storage:link) outside of the virtual machine, in the host pc, inside the root of the app folder.
我要解决的方法是在主机PC的app文件夹根目录内的虚拟机外部运行npm(和php artisan storage:link)。 Just a reminder: to do that you will need php installed in your host machine.
提醒一下:为此,您需要在主机中安装php。
5) All commands related to the app (and not the virtual machine) should be run inside the virtual machine, in the folder app (ex: /home/vagrant/code/myapp) or inside the app folder of your host machine. 5)与该应用程序(而非虚拟机)相关的所有命令应在虚拟机内部,文件夹app(例如:/ home / vagrant / code / myapp)或主机的app文件夹中运行。 Those two folders are in sync, thanks to vagrant.
由于无所事事,这两个文件夹是同步的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.