laravel Vagrant up 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35118146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 13:08:55  来源:igfitidea点击:

Vagrant up doesn't work

laravelsshvagrantvirtualboxhomestead

提问by Kerim

When I run 'vagrant up', I am getting below errors. I haven't any idea. Previously I was run without error. I sold SSD Harddisk and took it. When I want setup again, encountered this errors.

当我运行“vagrant up”时,出现以下错误。我没有任何想法。以前我运行没有错误。我卖掉了SSD硬盘并拿走了它。当我想再次设置时,遇到了这个错误。

/Users/KerimCaglar/sites/Homestead/scripts/homestead.rb:106:in `read': No such file or directory @ rb_sysopen - /Users/KerimCaglar/KerimCaglar/.ssh/id_rsa (Errno::ENOENT)
from /Users/KerimCaglar/sites/Homestead/scripts/homestead.rb:106:in `block (2 levels) in configure'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/kernel_v2/config/vm_provisioner.rb:72:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/kernel_v2/config/vm_provisioner.rb:72:in `add_config'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/kernel_v2/config/vm.rb:321:in `provision'
from /Users/KerimCaglar/sites/Homestead/scripts/homestead.rb:103:in `block in configure'
from /Users/KerimCaglar/sites/Homestead/scripts/homestead.rb:102:in `each'
from /Users/KerimCaglar/sites/Homestead/scripts/homestead.rb:102:in `configure'
from /Users/KerimCaglar/sites/Homestead/Vagrantfile:20:in `block in <top (required)>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/vagrantfile.rb:28:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:740:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:740:in `vagrantfile'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:486:in `host'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:208:in `block in action_runner'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/runner.rb:33:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/runner.rb:33:in `run'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:473:in `hook'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:722:in `unload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:177:in `ensure in <main>'
from /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:177:in `<main>'

回答by Mathew Tinsley

The important part of that error is here:

该错误的重要部分在这里:

No such file or directory @ rb_sysopen - /Users/KerimCaglar/KerimCaglar/.ssh/id_rsa

没有这样的文件或目录@rb_sysopen - /Users/KerimCaglar/KerimCaglar/.ssh/id_rsa

You either haven't generated your SSH key or you need to specify the correct path.

您要么没有生成 SSH 密钥,要么需要指定正确的路径。

If you look at your Homestead.yamlfile you should see the path to your ssh key:

如果您查看Homestead.yaml文件,您应该会看到 ssh 密钥的路径:

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

If your SSH key is somewhere else you'll need to specify the correct path. Otherwise you'll need to generate it.

如果您的 SSH 密钥在其他地方,您需要指定正确的路径。否则,您将需要生成它。

ssh-keygen -t rsa -C "[email protected]"

Source.

来源

回答by JBRWilkinson

The key part of the error is the duplicated path:

错误的关键部分是重复的路径:

/Users/KerimCaglar/KerimCaglar/.ssh/id_rsa (Errno::ENOENT)

/Users/KerimCaglar/KerimCaglar/.ssh/id_rsa (Errno::ENOENT)

Notice how the username is mentioned twice. I have found this to be caused by:

注意用户名是如何被提及两次的。我发现这是由以下原因引起的:

  1. Specifying too much path in the Vagrantfile, e.g.

    config.vm.provision "file", source: "KerimCaglar/.ssh/id_rsa", destination: ".ssh/rd_rsa"

  2. You're invoking vagrant upfrom a subdirectory - cd ..; vagrant upwill fix it.

  1. 在 Vagrantfile 中指定太多路径,例如

    config.vm.provision“文件”,来源:“ KerimCaglar/.ssh/id_rsa”,目的地:“.ssh/rd_rsa”

  2. 您正在vagrant up从子目录调用-cd ..; vagrant up将修复它。

回答by OJ Oyewole

If you've got Git installed, all you have to do is simply go generate your ssh key through the GUI. Help -> Show Key

如果您已经安装了 Git,您所要做的就是通过 GUI 生成您的 ssh 密钥。帮助 -> 显示密钥

enter image description here

在此处输入图片说明