Why PhpStorm Fails Trying to Get vagrant status When Using Hyper-V

I’m on a roll today – all about those extreme corner cases. I thought I had everything smoothed out – and Vagrant was working fine but then I booted up PhpStorm and tried attaching it to Vagrant.

Everything went okay under Settings–>Tools–>Vagrant but when I when to Settings–>PHP–>CLI Interpreters and tried using Vagrant for the interpreter there I started receiving an error:

Can't get Vagrant settings error occurred while executing "vagrant status" inside folder:

I’ll skip most of the troubleshooting steps I took other than to note that JetBrain’s idea.log provide an unhelpful error:

WARN - gins.vagrant.VagrantFileConfig - Error parsing Vagrant file org.jrubyparser.lexer.SyntaxException: syntax error, unexpected tLSHFT

And then there was a huge traceback (which I’ll spare you).

The actual problem is Hyper-V related. Hyper-V requires that Vagrant be run from an elevated (administrator) command line (which I’d done). JetBrains was unable to access some aspect of Vagrant because it was not running as an administrator.

Close out PhpStorm and reopen it as an administrator (right-click on icon, choose more, run as an administrator). Try configuring that CLI Interpreter again and it should go through with no problem! Now, I’m not particularly fond of having to Vagrant or PhpStorm in administrator modes…but if you are stuck with Hyper-V, this is one way to work around it.

If anyone comes up with a better solution, I’m all ears.

Leave a Reply