laravel 找不到HOME环境——展开`~'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27288947/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
couldn't find HOME environment -- expanding `~'
提问by xslibx
Im trying to start up Homestead 2.0 for a Laravel app however every time I run
我尝试为 Laravel 应用程序启动 Homestead 2.0,但是每次运行时
homestead up
I get the output
我得到输出
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/shared_helpers.rb:89:in `expand_path': couldn't find HOME environment -- expanding `~' (ArgumentError)
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/shared_helpers.rb:89:in `expand_path'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/shared_helpers.rb:89:in `user_data_path'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/manager.rb:16:in `user_plugins_file'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/manager.rb:27:in `instance'
from /Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:22:in `<main>'
What does couldn't find HOME environment -- expanding
~' mean and how can I fix it? I'm using Oh-my-zsh as a shell.
couldn't find HOME environment -- expanding
~' 是什么意思,我该如何解决?我使用 Oh-my-zsh 作为外壳。
回答by rahmat
Search your php.ini with this commands: php --ini
使用以下命令搜索您的 php.ini: php --ini
In your php.ini file, set variables_order = "EGPCS"
.
在 php.ini 文件中,设置variables_order = "EGPCS"
.
Thats it.
就是这样。
回答by Adunahay
I'm having the same issue. As a work-around, you can add
我有同样的问题。作为解决方法,您可以添加
ENV["HOME"] = "/Users/your-user-name"
ENV["HOME"] = "/Users/your-user-name"
to the file
到文件
/Applications/Vagrant/embedded/gems/gems/vagrant-*version*/lib/vagrant/shared_helpers.rb
right underneath require "tempfile"
to get it up and running
就在下面require "tempfile"
启动并运行
回答by michal.z
You have to specify HOME environmental variable for your shell. Now your home dir is being found by checking ~ which always returns your default home dir i.e. cd ~ takes you to home dir.
您必须为 shell 指定 HOME 环境变量。现在通过检查 ~ 找到你的主目录,它总是返回你的默认主目录,即 cd ~ 带你到主目录。
回答by Ga?l Roustan
The '~' shortcut in shell stands for the home folder for a user. For example, on OSX, if the user name is gael, the ~ is expanded (replaced) by the path which is /Users/gael.
shell 中的“~”快捷方式代表用户的主文件夹。例如,在 OSX 上,如果用户名为 gael,则 ~ 扩展(替换)为 /Users/gael 路径。
For the second part of your question, may try to set HOME before launching it : export HOME=/Users/gael
对于问题的第二部分,可以尝试在启动之前设置 HOME:export HOME=/Users/gael
回答by John Evans
Regarding the answers by @michal.z & @gael
关于@michal.z & @gael 的回答
I had this problem and I am able to successfully
我有这个问题,我能够成功
echo $HOME
which returns /home/my-username but I still got the error :-/
返回 /home/my-username 但我仍然收到错误:-/
Anyway. I chose to follow @Adunahay s advice and I manually added the environment variable to the shared_helpers.rb file.
反正。我选择遵循@Adunahay 的建议,并将环境变量手动添加到 shared_helpers.rb 文件中。