Vagrant 命令报错

Windows 安装完vagrant 不管什么命令都不行 一直报错

我是安装在F盘里 不管执行什么命令都报下面的错误
用户名是英文也没有什么中文路径 卸载重装好多次了 还是无法解决
请问有什么解决办法吗?

$ vagrant status

F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:44:in `encode!': "\\xE4" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to UTF-16LE (Encoding::UndefinedConversionError)
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:44:in `to_wide_string'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:67:in `create_environment_pointer'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb:28:in `start'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/windows/process.rb:70:in `launch_process'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/abstract_process.rb:81:in `start'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/subprocess.rb:155:in `block in execute'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/safe_chdir.rb:26:in `block (2 levels) in safe_chdir'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/safe_chdir.rb:25:in `chdir'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/safe_chdir.rb:25:in `block in safe_chdir'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/safe_chdir.rb:24:in `synchronize'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/safe_chdir.rb:24:in `safe_chdir'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/subprocess.rb:154:in `execute'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/subprocess.rb:22:in `execute'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/powershell.rb:191:in `version'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/powershell.rb:212:in `validate_install!'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/powershell.rb:113:in `execute_cmd'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/platform.rb:82:in `block in windows_admin?'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/platform.rb:84:in `windows_admin?'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/providers/hyperv/provider.rb:20:in `usable?'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:361:in `block in default_provider'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/registry.rb:49:in `block in each'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/registry.rb:48:in `each'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/registry.rb:48:in `each'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:347:in `default_provider'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:944:in `guess_provider'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:956:in `find_configured_plugins'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:984:in `process_configured_plugins'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:178:in `initialize'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/bin/vagrant:194:in `new'
        from F:/HashiCorp/Vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/bin/vagrant:194:in `<main>'
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
最佳答案

这个或许对你有帮助 github.com/hashicorp/vagrant/issue...

3年前 评论
Mars1499593644 (楼主) 3年前
Mars1499593644 (楼主) 3年前
讨论数量: 9
Summer

修改下内容,把图片去掉,把错误全部贴上来

3年前 评论
Mars1499593644 (楼主) 3年前

好好学习一下社区的文章: 提问的智慧!

3年前 评论
Mars1499593644 (楼主) 3年前

这个或许对你有帮助 github.com/hashicorp/vagrant/issue...

3年前 评论
Mars1499593644 (楼主) 3年前
Mars1499593644 (楼主) 3年前

I had the same issue and solved it today. (14.03.2021) You should go to "C:\HashiCorp\Vagrant\embedded\gems\2.2.14\gems\vagrant-2.2.14\bin" address and open "vagrant" file. At the beginning of the file, you will see "#!/usr/bin/env ruby" Paste the below 2 lines after this first line.

 Encoding.default_external = Encoding.find('Windows-1251')
 Encoding.default_internal = Encoding.find('Windows-1251')

Be careful, they are "1251", not "1250"

Solved. :)

问一下,为啥出这个错误啊?vagrant默认编码出错了吗?

2年前 评论

将这个文件.../HashiCorp/Vagrant/embedded/gems/2.2.19/gems/childprocess-4.1.0/lib/childprocess/windows/process_builder.rb里报错的44行,改成下面的

...
# newstr.encode!('UTF-16LE')
  newstr.encode!('UTF-16LE', invalid: :replace, undef: :replace, replace: '?')
...
2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!