+ Start a Discussion
Raviteja_KRaviteja_K 

Issue with SFDX: Authorize an Org

Hello All,
I am trying to Create a Hello World Lightning Web Component as mentioned in the URL below.
Hello World Lightning Web Component (https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component?trail_id=build-lightning-web-components)
But in VS code I am getting below output and did some analysis but unable to risolve 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
------------------------------Sometimes below error is coming-------------------
use a custom connected app and update OauthLocalPort in the sfdx-project.json file

Thanks in Advance :)
Parteek Goyal 3Parteek Goyal 3
Hi Raviteja_K,

You have to kill the port 1717 process. please follow below link, this may help you.
http://www.callstack.in/tech/blog/windows-kill-process-by-port-number-157#close-overlay

Please let me know in case of any issue.

Thanks,
Parteek
Raviteja_KRaviteja_K
Thank you @Parteek for responding quickly on my Question.
Post performing the steps mentioned in the given URL got output as mentioned below.

Starting SFDX: Authorize an Org
11:33:00.980 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=b5d7ace33b21^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=2tdcYoPQwS4SytSxyyCWZPvXbjG-cJG42iesCBF4DDo' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=b5d7ace33b21^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=2tdcYoPQwS4SytSxyyCWZPvXbjG-cJG42iesCBF4DDo' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=b5d7ace33b21^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=2tdcYoPQwS4SytSxyyCWZPvXbjG-cJG42iesCBF4DDo' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=b5d7ace33b21^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=2tdcYoPQwS4SytSxyyCWZPvXbjG-cJG42iesCBF4DDo' ] }

Please suggest me on this.
Thanks in Advance :)
Parteek Goyal 3Parteek Goyal 3
Hi Raviteja_K,

Did you check enviorment variables for your system. You must add below enviorment variables.

JAVA, Salesforce CLI, VS Code, System32

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks,
Parteek Goyal
Raviteja_KRaviteja_K

Thank you Prateek for your respone.

Issue is Resolved after setting Proxy settings.