Vagrant provision 命令因解释错误而失败

Vagrant provision command failing with bad interpret

我是新来的vagrant。我正在尝试在我的 Windows 电脑上使用 Vagrant 设置我的开发环境。但是当 运行 在我的终端上执行以下命令时:

    vagrant up --provision 

卡在以下错误中:

 /tmp/vagrant-shell: /tmp/populate_db: /usr/bin/php^M: bad interpret

请让我知道您反馈我出现上述错误的原因。

在此先感谢您的帮助。

您的文件包含 windows 编码的回车 return,这在 linux 世界中是不同的。

您的解决方案:

  1. 运行 你的文件通过 dos2unix 脚本 (http://dos2unix.sourceforge.net)

  2. windows 上最高级的编辑器(UltraEdit、Notepad++)允许您专门为 linux 保存文件格式(例如 UltraEdit 有 File/convert可选择转换为 linux)