Bundler 1.12.0 不能作为没有 $HOME 目录的用户 运行

Bundler 1.12.0 cannot be run as a user with no $HOME directory

使用最新版本的 bundler,我不断收到以下错误:

STDOUT: There was an error while trying to write to /home/user1/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47. 
It is likely that you need to grant write permissions for that path.

我是 运行 sudo su - user2 bundle install synapse,其中 user2 没有 HOME 目录。我正在尝试使用 Chef 安装 Airbnb Smartstack。

似乎最新版本的Bundler 坚持要将新的索引缓存文件写入$HOME/.bundle。这意味着命令如:

sudo su - homelessuser bundle install synapse

...当他们尝试写入调用 sudo ... 的用户的 $HOME/.bundle 时失败。

作为解决方法,我暂时将捆绑程序版本固定为 1.11.2。

注意 GitHub issue here