2

I am trying to create a Hello World Lightning Web Component as mentioned in the URL below. Hello World Lightning Web Component

But in VS code I am getting below output. I did some analysis but unable to resolve it. Please help me how can I proceed further.

VS code output:

Starting SFDX: Authorize an Org

09:42:18.175 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
ERROR running force:auth:web:login:  Cannot start the OAuth redirect server on port PortInUseAction. 

Try this: 
Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.
09:42:23.367 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername ended with exit code 1

Thanks in Advance :)

3 Answers 3

3

What you should do is stop Git service running in the background and authenticate your CLI with your devhub (the org you are using to create scratch orgs). Note somehere your devhub username and password and auth with this;

sfdx force:auth:web:login

After creating a scratch org and setting it as your default username, you can open with: sfdx force:org:open -u yourscratchorgusername

5
  • 1
    Thank you for your response.
    – user3008
    Jan 10, 2020 at 8:07
  • when I ran sfdx force:org:list --all it is returning Dev Hab alias Name along with UserName,OrgID and connected Status. Below this I am getting No active scratch orgs found. Specify --all to see all scratch orgs. How to create scratch ORG.
    – user3008
    Jan 10, 2020 at 8:10
  • @raviteja sfdx force:org:create -s -f config/project-scratch-def.json -a ProjectName sets up a scratch org [ -s default org for this project, -f path to config file, -a assign alias]
    – Atlas Can
    Jan 10, 2020 at 12:31
  • 1
    Just FYI, OP could also change the port being used by SFDX by setting the "oauthLocalPort" attribute on the sfdx-project.json file. Source: salesforce.stackexchange.com/questions/226114/… Jan 10, 2020 at 13:01
  • Thank you for the suggestion @RenatoOliveira.
    – Atlas Can
    Jan 10, 2020 at 13:10
1

The Error indicates Git service is running in background. You need to stop the running process to perform other commands.

Steps to Kill the Running process

1) Open the Command Promt.

2) Type the below line. Replace <yourPortNumber> with your port. In your case its 1717

netstat -ano | findstr :<yourPortNumber>

You will get below result enter image description here

3) Execute Below command. Replace <typeyourPIDhere> with your PID as shown in red circle. Here its 3740.

taskkill /PID <typeyourPIDhere> /F

4) You will get success Message 'The Process with PID 3740 has been terminated'

5) Then you can run your SFDX Commands.

0

I had exact same issue, the root cause is not 1717 port been taken, it's about your login url, you should use the url in your Setup => Domains. eg. my user login from scratch org works from

https://xxxxx-1490-dev-ed.lightning.force.com/

But at my domains it's

https://xxxxxx-drive-1490-dev-ed.cs18.lightning.force.com/

Difference: .cs18.

So pay attention on Login url, it should be from your domains.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .