Packages with git dependencies fail to install in 2022.2

We have a number of package dependencies which have dependencies on git packages. For example, in one package.json the dependencies section contains:

    "dependencies": {
        "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask"
    },

This is working without issues in Unity 2021.3.15, but when when trying to install a package with the above dependency in 2022.2 I get the error:

[Package Manager Window] Error adding package: git@github.com:<repo>.git.
Unable to add package [git@github.com:<repo>.git]:
  Package <package_name>@git@github.com:<repo>.git has invalid dependencies or related test packages:
    com.cysharp.unitask (dependency): Version 'https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask' is invalid. Expected a 'SemVer' compatible value.
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

Somewhat interesting, as well: if I take a Unity 2021 project which already has one of these packages installed and upgrade to 2022, I don’t see any errors related to the package version and the project builds just fine.

afaik packages cannot depend on git repositories, the git url only works for packages themselves (manifest.json)
no idea why it would work in that one project

Ah, maybe it was a bug that it worked in the first place, then…

It’s a really unfortunate limitation since it means we have to manually manage the dependencies of our dependencies in each project…

you could setup your own npm registry

or clone the dependent package to a common directory and import it from disk, that way you can add a dependency to it i think

1 Like