Fixing a private package error with composer
1 min read

Fixing a private package error with composer

Fixing an error for "Could not parse version constraint branch"
[UnexpectedValueException] Could not parse version constraint branch#3de8008: Invalid version string "branch#3de8008"

The error above popped up when I tried to install a package locally via Composer. On composer.json, I had the following package definition:

    "require": {
        "package_owner/package_name": "branch#3de8008",
}

This pointed to a particular commit that I wanted to include when I got the error. It turns out that all packages that are installed locally or via private packages, have to be prepended with dev- so this fixed the issue.

    "require": {
        "package_owner/package_name": "dev-branch#3de8008",
        }