Vagrant Laravel Homestead - 跑步时出错

时间:2016-03-20 06:55:04

标签: laravel vagrant homestead

我已按照https://laravel.com/docs/5.0/homestead上的教程进行操作,当运行'vagrant up'步骤时,我收到以下错误消息(如下) 有什么想法是什么问题?运行最新版本的Oracle VirtualBox和最新版本的Vagrant。此致

-

C:\Users\Anders\Vagrant\Homestead>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead-7
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 (guest) => 8000 (host) (adapter 1)
    default: 443 (guest) => 44300 (host) (adapter 1)
    default: 3306 (guest) => 33060 (host) (adapter 1)
    default: 5432 (guest) => 54320 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
GuestAdditions versions on your host (5.0.16) and guest (5.0.12) do not match.
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
linux-headers-3.19.0-25-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the
 box /tmp/VBoxGuestAdditions.iso
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting rea
d-only
Installing Virtualbox Guest Additions 5.0.16 - guest version is 5.0.12
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.16 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.12 of VirtualBox Guest Additions...
Stopping VirtualBox Additions ...fail!
(Cannot unload module vboxguest)
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Stopping VirtualBox Guest Addition service  ...done.
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.16. Some
 functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/Anders/Vagrant/Homestead
    default: /home/vagrant/Code => C:/Users/Anders/Code
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`,
actimeo=1 home_vagrant_Code /home/vagrant/Code
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant`,actimeo=1 home_vagran
t_Code /home/vagrant/Code

The error output from the last command was:

unknown mount option `actimeo=1'
valid options:
  rw         mount read write (default)
  ro         mount read only
  uid       =<arg> default file owner user id
  gid       =<arg> default file owner group id
  ttl       =<arg> time to live for dentry
  iocharset =<arg> i/o charset (default utf8)
  convertcp =<arg> convert share name from given charset to utf8
  dmode     =<arg> mode of all directories
  fmode     =<arg> mode of all regular files
  umask     =<arg> umask of directories and regular files
  dmask     =<arg> umask of directories
  fmask     =<arg> umask of regular files

C:\Users\Anders\Vagrant\Homestead>

-

流浪文件:

-

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exists? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
    end

    if File.exists? homesteadYamlPath then
        Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
    elsif File.exists? homesteadJsonPath then
        Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
    end

    if File.exists? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath
    end
end

-

yaml文件:

-

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/Vagrant/Homestead/homestead.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code
      type: "nfs"

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public
      hhvm: true

databases:
    - homestead

3 个答案:

答案 0 :(得分:6)

带有Homestead的issue you're experiencing已记录在Github中。提供了一种解决方法,如下所示:

  

解决方案:删除类型:&#34; nfs&#34;在您的Homestead.yaml文件夹。

     

http://docs.vagrantup.com/v2/synced-folders/nfs.html

     

&#34; Windows用户:NFS文件夹在Windows主机上不起作用。流浪汉会   忽略您在Windows上对NFS同步文件夹的请求。

原始答案(针对编辑前的问题)

现在问题似乎与你的ssh密钥有关,或者缺乏。

No such file or directory @ rb_sysopen - C:/Users/Anders/.ssh/id_rsa (Errno::ENOENT)

标题为“设置您的SSH密钥”的部分in the guide you linked具有以下说明,可帮助您生成一个(根据相关的Windows说明进行修剪):

  

设置SSH密钥

     

[...]

     

在Windows上,您可以安装Git并使用Gi​​t附带的Git Bash shell发出上述命令。或者,您可以使用PuTTYPuTTYgen

     

创建SSH密钥后,请在Homestead.yaml文件的authorize属性中指定密钥的路径。

如果您对命令行不太满意,我建议您使用PuTTYgen方法。

答案 1 :(得分:2)

这是〜/ .homestead目录中的Homestead.yaml文件存在问题。我需要查看文件内容以帮助您。

在修改了缩进样式以仅使用空格字符后,另一个问题发生了,因为您尚未生成一对(公共和私有)密钥。要做到这一点:

mkdir -p ~/.ssh && cd ~/.ssh

ssh-keygen -b 2048 -t rsa -C "you@domain.com"

您可以使用默认文件名(id_rsa),输入密码并重复相同的密码。

答案 2 :(得分:1)

万一其他人最终通过Google来到这里,并且没有像我一样阅读所有注释,那么

我遇到了无法 componentWillUnmount() { firebase.database().ref('example').child(this.state.somethingDyamic).off('value'); }; doSomething() { firebase.database().ref('example').child(this.state.somethingDyamic).on('value', (snapshot) => { ... }); } 的问题,并出现以下错误:

vagrant up

正如卢卡斯提到的here Windows用户可以安装vagrant-winnfsd插件,该插件使您可以在Vagrant和Homestead中使用NFS共享文件夹。

因此,我通过运行Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was: mount -t vboxsf -o actimeo=1,nolock,uid=1000,gid=1000 var_www_dev.mybox /var/www/dev.mybox The error output from the command was: fmask =<arg> umask of regular files ,然后运行vagrant plugin install vagrant-winnfsd解决了该错误。