SalesforceDX – Fixing ‘No AuthInfo Found for Name myscracthorg’ Error

  1. I logged in my dev org:
    sfdx force:auth:web:login -a dev-hub –setdefaultdevhubusername
  2. Then I created a new scratchorg:
    sfdx force:org:create -f config/project-scratch-def.json –setalias scratchorg4 –durationd days 30 –targetdevhubusername myusername@gmail.com
  3. I pushed my changes to my new scratchorg:
    sfdx force:source:push -u myscratchorg
  4. When I try to open i receive an error:
    sfdx force:org:open -u myscracthorg
    sfdx force:org:open -u myscracthorg
    ERROR running force:org:open: No AuthInfo found for name myscracthorg

Command sfdx force:org:list returns successfull result, I have 2 scratch orgs.

I tried to delete all my scratch orgs and repeated all steps from the begining but no success.

Has anyone encountered a similar problem?

Best Answer

From the script you provided you created Scratch Org with alias 'scratchorg4', but then you're trying to open 'myscracthorg'. Try running sfdx force:org:list to display list of your Scratch Orgs

Side Note. You use 3 different aliases:
- scratchorg4 for creation
- myscratchorg for push
- myscracthorg for openning

probably typos. If this is one bash/cmd script set org value to some variable or just add -s param so org:create, so this Scratch Org will be used by default if no username is specified