I'm working on Salesforce Dx trailhead . When creating Scratch org using command

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

I'm getting this error:

ERROR: No defaultdevhubusername org found.
Try this:
Run the "sfdx force:auth" commands with --setdefaultdevhubusername to connect to a Dev Hub org and set it as your default Dev Hub.
Run "force:org:list" to see a list of locally registered orgs.
Run "sfdx force:config:set defaultdevhubusername=" to set your default Dev Hub username.

Even I tried to set default Org using below command

sfdx force:auth:web:login --setdefaultdevhubusername --setalias DevHub

But I'm getting this error:

ERROR: ENOENT: no such file or directory, open 'C:\Users\ABC\AppData\Local\sfdx\client\node_modules\content-type\index.js'.

In trailhead creating scratch org is given as 3rd command, I'm not sure if I need to login in DevHub or not, as there is no other information available in trailhead.


Today I again tried to Authorize Developer Hub (Dev Hub) org, set it as default by using below command:

sfdx force:auth:web:login --setdefaultdevhubusername --setalias DevHub

After authorizing dev hub, I was able to create scratch org.

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.