Windows 使用 Homsetead 报错踩坑记录
在Windows
中搭建Homsetead
使用命令vagrant up
报错
$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
D:/HashiCorp/Vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/provisioners/file/config.rb:20:in `expand_path': incompatible character encodings: UTF-8 and GBK (Encoding::CompatibilityError)
from D:/HashiCorp/Vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/provisioners/file/config.rb:20:in `expand_path'
from D:/HashiCorp/Vagrant/embedded/gems/2.2.6/gems/vagrant-2.2.6/plugins/provisioners/file/config.rb:20:in `validate'
原因就是用户名是中文的
打开控制面板
中更改用户类型
点击用户
选择更改用户名称
改成英文
名称
此时我们在运行vagrant up
命令,结果发现还是报错
虽然我们修改了用户名称但是我们的文件还是中文的路径:C:\Users
现在我们右击此电脑
选中管理
选择本地用户和组
中的用户
右击Administrator
选择属性
把账号已禁用
取消掉,点击确定
注销
当前账户,选择Administrator
账户登陆,之后我们打开此电脑
到C:\Users
吧文件改成英文名
现在修改注册表
windows+R
打开运行,输入regedit
点击确定
即可
依次展开HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Profilelist
将其修改成对应的名字
到此就完成了,但是,我们要把以前的电脑的环境变量修改一下(有些需要修改)
再一次运行vagrant up
发现还是报错………………
Command: ["import", "\\?\C:\Users\Administrator\.vagrant.d\boxes\lc-VAGRANTSLASH-homestead\
6.1.0\virtualbox\box.ovf", "--vsys", "0", "--vmname", "lt-settler_default_1529197839254_477_153171
0722519_67195", "--vsys", "0", "--unit", "9", "--disk", "C:\Users\Administrator\VirtualBox VMs\l
t-settler_default_1529197839254_477_1531710722519_67195\box-disk001.vmdk"]
Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \?\C:\Users\Administrator.vagrant.d\boxes\lc-VAGRANTSLASH-homestead\6.1.0\virtualbox\
box.ovf...
OK.
0%...10%...20%...30%...40%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Code VBOX_E_FILE_ERROR (0x80BB0004) - File not accessible or erroneous file c
ontents (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)"
at line 886 of file VBoxManageAppliance.cpp
打开我们的Oracle VM VirtualBox
软件,左上角管理
的全局设定
,默认电脑的虚拟位置改一下
此时我们再次运行vagrant up
,结果他又报错了
...
...
There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. Command: ["startvm", "da766e1e-a423-4f4d-a37e-8523e39b294f", "--type", "headless"] Stderr: VBoxManage.exe: error: Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
这个是因为我们开启了Hyper-V
,也就是说用了它就不能用Docker
。
以管理员的方式启动 CMD,输入 bcdedit
回车,结果如下图显示:
禁用掉 Hyper-V: bcdedit /set hypervisorlaunchtype off
然后重启电脑再运行 vagrant up
就成功了。如果要打开 Hyper-V:bcdedit /set hypervisorlaunchtype auto
需要重启电脑生效。
重启电脑,再次运行vagrant up
命令,终于不在报错
成功
输入命令vagrant ssh
附上参考链接:
修改系统用户名:https://blog.csdn.net/tanzey/article/details/82657816
关闭HYper-V:https://learnku.com/articles/29420
本作品采用《CC 协议》,转载必须注明作者和本文链接
注册表都用上了,太难了
@lovecn 还好把,主要是修改一下路径,涨记性,一定不要在用中文命名了
用户名中文,很多软件都会引起莫名其妙的问题,深受其害,所以后来基本上都用英文命名,略过很多疑难杂症,感觉自己多活了好多年
新建一个用户会不会简单点
@laravel_denghy 直接新建一个英文用户名,在安装,确实方便很多。
非常感谢Hyper-V这段,困扰了很久
新建个用户不更快些吗?
@MuYan 应该是的,没尝试,面对困难,不要怕,解决它,奥里给。
@ColdCGH 我也被这些困扰了好久,分享一下,希望大家能少浪费些时间
最多就是虚拟没开。我遇到了powershell版本低的问题......果断还是用laradocker
兄弟 np
修改用户名后切回原来账号的桌面和配置会不会重置
@huangyuanlin 桌面和配置不会重置,解决就好,这坑踩的心累