Apologies for the long title, but essentially I have an unlocked package (unlockedPackageB) that is dependencies to another unlocked package (unlockedPackageA).

unlockPackageA has classes that refer to a managed package, which is defined in its package folder (via force-app/main/default/InstalledPackages).

I have defined unlockPackageB's dependancies with unlockPackageA in its sfdx-project.json file. But, when I'm attempting to create a new unlockPackageB version (sfdx force:package:version:create), I'm seeing errors during Verifying dependencies in which is unable to compile unlockPackageA's classes due to components from the manage package not existing. This is not an issue when creating package versions against unlockPackageA.

Wondering if anyone has any advice on how to deal with these issues. Thanks!

1 Answer 1


I'm fairly certain you need to define the dependency on the managed package in packageB the same as you do in packageA. The dependency resolution for 2GP packages isn't recursive. Thus, as currently configured, building a new version of packageB spins up a build scratch org and installs the dependencies defined for packageB. That tries to install your packageA which fails because it requires the managed package and packageB never defined the managed package as one of its dependencies.

  • Thanks for responding Jason, I've tried that approach. It didn't work. I've also tried putting it unpackagedmetadata folder.
    – user120468
    Commented Aug 6, 2022 at 15:26
  • So you tried making packageB have dependencies on both packageA and on the managed package and the managed package is first in that dependencies list? Also, are you building full packages or are these org dependent packages? Commented Aug 8, 2022 at 13:42
  • these are full unlock packages. I don't have the manage package in packageA's dependancies list. Instead, I have a managePackage.installedPackage-meta.xml in force-app/main/default/InstalledPackages (which works when creating package versions for packageA). Curious how we can list manage packages as a dependency. How do we get the package version Id? And would this work given these manage packages are not stored in our devhub environment.
    – user120468
    Commented Aug 9, 2022 at 17:52
  • If you have an org where the package is installed, you can query the InstalledSubscriberPackage object's SubscriberPackageVersionId field in the Tooling API to get the 04t package version id Commented Aug 11, 2022 at 13:43
  • that worked! thanks Jason!
    – user120468
    Commented Aug 12, 2022 at 21:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .