Vagrant和Virtual Box都安装了我的Vagrant UP命令,给出路径错误



我正在使用git bash和vagrant文件已添加到我的项目中,但是当我尝试运行vagrant command时,它会产生此错误:

$ vagrant up
The executable 'powershell' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.

帮助我解决此问题。

流Vagrant文件包含:

Vagrant.configure("2") do |config|

解决我的问题的是我发现的评论, antoinebou13 在这里

PC:WSL Ubuntu 18.04Windows 10具有安装的Vagrant 2.2.7和VirtualBox 6.1

curl -O https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.deb
sudo apt install ./vagrant_2.2.7_x86_64.deb
export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
export PATH="$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0"
export PATH="$PATH:/mnt/c/WINDOWS/system32"
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"

还将您的项目放入/mnt/c/目录中https://www.vagrantup.com/docs/other/wsl.html

如果您在简单的CMD会话中,请检查您的路径:

echo %PATH%

它至少应包括%SYSTEMROOT%System32WindowsPowerShellv1.0

这取决于您的操作系统和执行上下文。
例如,Mitchellh/Vagrant-Aws问题363提及:

我使用ZSH从Cygwin终端上运行Vagrant时遇到了这个问题。

我通过将通往powershell.exe的路径附加到我的PATH
来工作。
.zshrc中:

PATH="${PATH}:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"

问题来自网络断开连接,服务器重新设置了与客户端的连接,使原始SSL握手弄乱了。

只需确保连接稳定并重新运行命令:

$ vagrant up

它将重新启动并完成下载。

最新更新