Recently I noticed that some of my VS Code extensions weren’t working properly. Specifically, the ones that perform PHP linting and syntax checking. Opening up the VS Code developer tools showed this puzzling message:
Activating extension failed: Invalid Version: is.
I couldn’t find anything matching that online, and trying to debug it further didn’t reveal anything useful.
I eventually took the (somewhat extreme) path of removing VS Code entirely (application, settings, extensions), and even removing my entire Zsh environment. The plan was start all over again and see if that helped.
I then downloaded the extension code and used the extension development environment to step through the extension and saw that it was loading PHP to parse out the version (
php --version), and the response from PHP was:
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Feb 28 2021 09:53:14) ( NTS )
The parsing is a regular expression that’s looking for
PHP 7.3.24, but is finding the
PHP is from the second line.
The solution is to install PHP with brew, and use that version.
brew install php
Now to restore my VS Code and Zsh environment.
Leave a Reply