I have a problem installing dependencies from sfdx-project.json. I created a Second Generation Package and generated a new version. I specified dependency as follows:

"dependencies": [
    "subscriberPackageVersionId": "04t0V000001Dyaf"

But when I try to run

sfdx force:package:install --package 04t...

I get the following error

ERROR: Encountered errors installing the package!,Installation errors:
1) Invalid Upgrade., Details: The package you're installing depends on package 'CloudCraze', version '3.119'. Install package 'CloudCraze' in the target org before you install package '...'.

Shouldn't sfdx install dependencies by itself for Second Generation Packages?

Or dependencies are only used for a successful creation of package versions?

P.S. I know that I can install the dependent package using with preceding sfdx command, but still.

  • where in the documentation is this mentioned? (that dependencies for second gen packages are/should automatically be installed, out of curiosity)
    – glls
    Jul 6 '18 at 12:10
  • You correct, it doesn't. But I haven't found much about this attribute in the documentation, so I decided to ask a question and see maybe I missed something.
    – ytiq
    Jul 6 '18 at 12:38

You're right, dependencies are only used to create a new Package Version. If you need to install your Package in a Scratch Org or a Sandbox, you'll need to manually.

That's a little bit painful but remember Package 2 is still in beta, so I would definitely reach out to the Trailblazer Community Packaging 2 Beta Chatter Group to let your voice be heard.


This might help:
1. sfdx plugins:install sfdx-dependency-plugin
2. sfdx dependency:order -p 04t.. --maxversion --withrootpackage

You'll get a list of packages versions ids in the right installation order.

Then, using while read ; do...; done you can automatically install package with all its dependencies

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.