I went to load up my dev/localhost environment today and when i opened terminal and cd ..
to my destination localhost folder. I do what i do everyday and i vagrant reload
. Generally my localhost is up in about 30 seconds after entering my password.
Today when i tried to vagrant reload
i got the message "default: VM not created. Moving on..."
I then tried to vagrant up
to see if it was maybe down for some reason and i got the error message
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/me/Documents/Development/website/www/base
On the browser side of things the page just looks like this:
Index of /
[ICO] Name Last modified Size Description
Apache/2.2.22 (Ubuntu) Server at dev.webite.com Port 80
How do i get my localhost running again? It's like my machine was deleted or disappeared.
My vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure(2) do |config|
config.vm.box = "magento"
config.vm.network :forwarded_port, guest: 80, host: 8085
# config.vm.network :public_network
config.vm.network "private_network", ip: "192.168.19.88"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
config.vm.provider :virtualbox do |vb|
#vb.gui = true
vb.customize ["modifyvm", :id, "--memory", "4096"]
vb.cpus = 4
end
end
The issue was that vagrant created another VM in virtual box while the correct instance existed.
To be able to operate the correct virtual box VM from vagrant, follow the steps:
run VBoxManage list runningvms
and note the ID of the VM that you want to operate
edit the file .vagrant/machines/default/virtualbox/id
and set the ID found in step above
run vagrant command (halt/up) will operate the expected VM
OLD ANSWER
If you use a custom base
box its probably better to:
add the box to vagrant
vagrant box add <name of your box : base> <path to the box file>
init and up vagrant with this box
vagrant box init <name of your box : base>
vagrant up
If you want to reference a config.vm.box_url
to be a local file you must specify as the path to the box file (not a directory - vagrant will uncompress for you)
config.vm.box_url = "file://<path to a box file>"