I've been walking through the ISV DX session here with a test package in preparation for migrating my general package development to DX

It went pretty well until the final step - installing the new beta package in a test scratch org. I created a new DX scratch org with a new alias, but I can't install the package into that org via the CLI or UI

Create a new Org:

$ sfdx force:org:create --definitionfile config/KW_TEST_SCRATCH2-scratch-def.json --setalias testorg3

Then tried to install package into that new org:

$ sfdx force:package:install --targetusername testorg3 --id 04tXXX
--wait 10

ERROR: Encountered errors installing the package! ERROR: Installation errors:
1) Package(033XXX) The package already exists., Details: You can't install a package into the org where it was created.

But that alias has a different Org Id according to the Org List, and when I log in, the package definitely isn't there.

Feel like I am just missing something obvious, but I've tried numerous things and so far, no joy...


I think I figured it out. I am using Illuminated Cloud, but was creating QA Orgs via the Command Line to test out the CLI. The folder I was using was for the scratch org project to build my test package - so the sfdx-project file had a namespace set since this is a managed package.

But I wasn't appreciating the difference between the sfdx-project.json file and the project-scratch def file. So I think the scratch orgs for qa were being created with that namespace because they were all using same sfdx-project file even though I had created different definition files.

What I found was that once I created a new project that wasn't referencing a namespace and created my orgs from that directory, I was able to create a new scratch org and install my package without issue. Having worked that out, I discovered the "--nonamespace" parameter which is just for this purpose - create a project but explicitly don't set the namespace

|improve this answer|||||

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.