fugafuga.write

日々のログ



Vagrant で rails の better_errors が動かない

動かないメモ

Vagrantfile の config.vm.network :private_network, ip: "192.168.33.10"を有効にする。

その後の vagrant up でエラーが出た。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory

VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 68 of file VBoxManageHostonly.cpp

以下で解消。

$ sudo /Library/StartupItems/VirtualBox/VirtualBox restart

rails ディレクトリ配下の config/environments/development.rb に以下を追加。

BetterErrors::Middleware.allow_ip! "192.168.33.1"

<参考>
Rails - better_errorsがvagrantで動作しない対処 - Qiita