Error while creating scratch Org

858    Asked by LessieSchur in Salesforce , Asked on Aug 7, 2021

I was trying to create a scratch def org following the trailhead

https://trailhead.salesforce.com/content/learn/projects/quick-start-salesforce-dx/create-and-test-our-scratch-org?trail_id=sfdx_get_started

But get stuck in the following section Create and Test Our Scratch Org - Step 2

while executing the following command getting the following error.

sfdx force:org:create -s -f config/project-scratch-def.json -a dreamhouse-org

ERROR running force:org:create: Must pass a username and/or OAuth options when creating an AuthInfo instance.

Steps Executed


Created Project in VSCode

Authorized an Org

Executed Trailhead steps as mentioned in the link

How can I resolve the error while creating scratch def org?

Answered by Sumiko Lacoste

To resolve this error, do the following step :

1- Re auth your org in ebikes-lwc folder(or your named folder) via following

          sfdx force:auth:web:login -d -a ebikeslwcOrgAlias

2 -Now try to create scratch org :

          sfdx force:org:create -s -f config/project-scratch-def.json -a ebikes

 How do I create a Salesforce scratch def org account in salesforce?

 Here we have the steps for Creating a Scratch def Org via an Org Shape in Salesforce:

  • Step 1: Getting Started
  • Step 2: Copy the SF Organization ID
  • Step 3: Paste the Organization ID
  • Step 4: Authorize both orgs in VSC.
  • Step 5: Create the shape org using sfdx
  • Step 6: Create a scratch org.
  • Step 7: Run the “create” command.



Your Answer

Answers (2)

Dev Hub must be enabled in the Salesforce Developer Edition organization or the Trailhead Playground organization you are using. Make sure you are logged in to the Dev Hub organization. Dev Hub is enabled in that organization. If it is not enabled, go to Salesforce => find "Dev Hub" in the settings and turn on "Enable Dev Hub".

1 Year

Go to Dev Hub org (Salesforce Production org / Developer Edition org that you use as Dev Hub). Then go to Setup → find Dev Hub → make sure you have Enabled Dev Hub (enable the solitaired checkbox). Finally click Save to undo.

1 Year

Interviews

Parent Categories