function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rohit Goyal 5Rohit Goyal 5 

Getting Error : Cannot start the OAuth redirect server on port PortInUseAction : while login Devhub

When I'm trying to use 
> sfdx force:auth:web:login -d -a DevHub
Getting Error - 
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.

 
Best Answer chosen by Rohit Goyal 5
Rohit Goyal 5Rohit Goyal 5
Restarting the terminal have fixed this problem.

All Answers

Rohit Goyal 5Rohit Goyal 5
Restarting the terminal have fixed this problem.
This was selected as the best answer
Hari Kumar EnagantiHari Kumar Enaganti
Rohit Goyal 5
"Restarting the terminal"--what it means Terminal here.Restarting VSCode or System/Laptop?

After restarting "Error: spawn cmd ENOENT" this kind of issue is displaying
 
DebadyutiDebadyuti
Try killing the process :

macOS or Linux

To recover from a failed org authorization on macOS or Linux, use a terminal to kill the process running on port 1717.
1. From a terminal, run:
1lsof -i tcp:1717
2. In the results, find the ID for the process that’s using the port.

3. Run:
kill -9 <the process ID>

Windows

To recover from a failed org authorization on Windows, use the Task Manager to end the Node process.
1. Press Ctrl+Alt+Delete, then click Task Manager.
2. Select the Process tab.
3. Find the process named Node.
4. Select the process that you want to end, and then click End Process.

Reference : https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_troubleshoot_cancel_auth.htm
Jhonny Alexander Ramirez ChiroqueJhonny Alexander Ramirez Chiroque
En Windows hay que detectar que proceso esta usando el puerto 1717
c:\Jack> netstat -oan

con este comando busco que aplicacion esta usando el puerto 1717, una vez que obtengo el PID (por ejemplo 18480), se elimina el proceso con el siguiente comando
c:\Jack> tasklist /svc /FI "PID eq 18480"  -- Obtengo el nombre de la aplicacion 
c:\Jack> taskkill /F /PID 18480-- Elimino la aplicacion que esta usando ese PID