【问题标题】:Laravel homestead command does not work on restartLaravel homestead 命令在重启时不起作用
【发布时间】:2015-05-18 16:10:49
【问题描述】:

我已经在我的 mac 机器上成功安装了 homestead,我已经使用以下命令设置了路径

export PATH=~/.composer/vendor/bin:$PATH

但是每次我重新启动我的机器时,homestead 命令都不起作用,我必须再次运行export PATH=~/.composer/vendor/bin:$PATH 来解决这个问题。

请提出解决此问题的方法。感谢您的帮助。

【问题讨论】:

标签: shell laravel command vagrant homestead


【解决方案1】:

使用 shell 配置器将该行放入 /etc/profile(对于整个系统)或只是 ~vagrant/.profile(对于您的用户)。像这样:

config.vm.provision "set-path", type: "shell" do |s|
    s.inline = "grep "~/.composer/vendor/bin" ~vagrant/.profile &> /dev/null || echo "export PATH=~/.composer/vendor/bin:\$PATH" >> ~vagrant/.profile"
end

这会执行grep 来检查该文本是否在文件中,如果返回非零结果 (||) 则将该行附加到文件末尾。

【讨论】:

  • 在您的 Vagrantfile 中,在顶级 Vagrant.configure 块中。
猜你喜欢
  • 1970-01-01
  • 2014-08-29
  • 1970-01-01
  • 2013-09-25
  • 2015-09-24
  • 2021-05-10
  • 2016-10-29
  • 2016-02-01
  • 2019-08-18
相关资源
最近更新 更多