VS Code – invalid version: is

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.

It didn’t.

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.

Thanks Apple.

The solution is to install PHP with brew, and use that version.

brew install php

Now to restore my VS Code and Zsh environment.

Advertisement

One response to “VS Code – invalid version: is”

  1. > WARNING: PHP is not recommended

    Quite opinionated for an OS.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: