0

I am trying to complete the challenge for salesforce DX build your unlock package. I have been having issues with it so please bare with me when i can explain the issue. I created a project early last month to complete the badge..I got to this point ( see below Image)

enter image description here

then i tried to ask help here but whatever response i got it was not enough for me to resolve this issue..so i deleted the project...and create a new one...i cloned "dreamforce" through github as advised in the badge and stat working and making progress....Now i have reached to this point of badge (see below image) enter image description here

and in CLI when i enter this command "sfdx force:package:create --name dreamhouse --description "My Package" --packagetype Unlocked --path force-app --nonamespace --targetdevhubusername DevHub"

I get this" ERROR running force:package:create: The package name must be unique for the namespace." (see image below) enter image description here

so it turns out that when i was doing the project before "dreamforce" unlocked package was installed..but now the issue i have that how do i bring that into my my SFDX Json file so it can look like as shown in the "Trailhead badge challenge page" or like i had it before (see image 1).. I am looking for guidance and i would appreciate if someone can be patient with me to help me through this challenge please.Its a very kind request! Thank you

0

You can't create the package because it's already created. To fix this problem, do this:

sfdx force:package:list

You'll get some output that shows your packages:

Namespace Prefix  Name              Id                  Alias  Description  Type
────────────────  ────────────────  ──────────────────  ─────  ───────────  ────────
                  dreamhouse        0Hoxxxxxxxxxxxxxxx                      Unlocked

Open sfdx-project.json, and edit it so it has an packageAliases section:

{
   "packageDirectories": [
      {
         "path": "force-app",
         "default": true,
         "package": "Dreamhouse",
         "versionName": "ver 0.1",
         "versionNumber": "0.1.0.NEXT"
      }
   ],
   "namespace": "",
   "sfdcLoginUrl": "https://login.salesforce.com",
   "sourceApiVersion": "47.0",
   "packageAliases": {
      "dreamhouse": "0Hoxxxxxxxxxxxxxxx"
   }
}

Note: If the sfdcLoginUrl or path is different, use whatever is in your file.

At this point, you should be able to continue with the next step with creating the unlocked package.

| improve this answer | |
  • do i edit Sfdx project json in cli or go in the folder on my desktop and edit there? – zsk_1 Feb 5 at 3:16
  • @zsk_1 Presumably, use the one that's in your screenshot, just edit it to have a packageAliases (leave everything else as-is). – sfdcfox Feb 5 at 3:34
  • i posted another question yesterday..can you please kindly guide me with that – zsk_1 Feb 6 at 2:52

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.