[SalesForce] Error while creating scratch Org

I was trying to create a scratch 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

I'm stuck in the following section Create and Test Our Scratch OrgStep 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

  1. Created Project in VSCode
  2. Authorized an Org
  3. Executed Trailhead steps as mentioned in the link

Best Answer

You have to login first.

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

(This is in the prior step, you can't work on them separately.)

Related Topic