4

My sfdx-project.json looks like this:

{
    "packageDirectories": [
        {
            "path": "force-app",
            "package": "my package",
            "versionName": "ver 0.3",
            "versionNumber": "0.3.0.NEXT",
            "definitionFile": "config/project-scratch-def.json",
            "ancestorId": "v2-id"
        }
    ],
    "namespace": "my_namespace",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "48.0",
    "packageAliases": {
        "my package": "package-id",
        "my package@0.1.0.4": "v1-id",
        "my package@0.2.0.1": "v2-id"
    }
}

So going from 0.1.0.1 to 0.2.0.1 (v1-id to v2-id) was fine. It let me install v2 and update it from v1. Now I need a patch as I just made a few changes, so trying to patch off of v2. It packages and I can promote, then when I go to install in an org with no package yet at all (so clean install) I get the following error:

Encountered errors installing the package!,Installation errors:

  1. Cannot install component of type:Layout named:my_metadata__mdt-my metadata Layout subjectId:some-id because it was used as a scratch org ancestor., Details: package.xml: Cannot install component of type:Layout named:my_metadata__mdt-my metadata Layout subjectId:some-id because it was used as a scratch org ancestor.

Does this have to do with the definitionFile in the packageDirectories? I can't really find any information on this error from searching around. Does anyone know what this means and how to fix?

1 Answer 1

9

I just ran into the same issue. Trying to install my namespaced package into a scratch org with the same namespace.

You need to create a scratch org without a namespace using the --nonamespace flag and install your packages in there.

Namespaced scratch orgs should be used for development work on a package.

Non-namespaced scratch orgs should be used for testing installs of your package.

1
  • That was the solution for me, thank you for that!
    – jeromegv
    Sep 16, 2020 at 19:55

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.