Friday, March 15, 2019

Salesforce CLI - How to fix error: 'EACCES': listen EACCES 127.0.0.1:1717


I faced the following error today when logging in Salesforce Dev Hub using the CLI.

'EACCES': listen EACCES 127.0.0.1:1717

And what I did to get over it was to change that default port 1717 to something else.

The steps are as below.
  1. Open a Command Prompt window.
  2. Go to a folder in your local machine using cd command. For example, in my case: cd Samples\Salesforce\my_sfdx_project
  3. Create a Salesforce DX project using sfdx force:project:create command. In my case: sfdx force:project:create -n force-proj01
  4. In the newly created folder force-proj01, open sfdx-project.json file and add following line: "oauthLocalPort": "7717",.
    The file will eventually contain:
  5. Log in using the command sfdx force:auth:web:login -d -a DevHub. Now the browser window can open up. Fill in your user name and password to log in.
  6. The browser now will redirect to such a link as http://localhost:1717/OauthRedirect?code=..., which is not existing.
  7. Change the port in the link above from 1717 to 7717 and press Enter.
  8. Now I can log in to Dev Hub successfully.

2 comments:

  1. Hello Thuc,
    I have created project in Visual Code, I followed all your steps, but still failed.

    Error: listen EACCES: permission denied 127.0.0.1:1717
    at Server.setupListenHandle [as _listen2] (net.js:1303:21)
    at listenInCluster (net.js:1368:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1505:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:8) {
    code: 'EACCES',
    errno: -4092,
    syscall: 'listen',
    address: '127.0.0.1',
    port: 1717
    }

    I got this error when run "sfdx auth:web:login -s -a conference". Even though, I changed port in the link, but no luck for me.

    Could you give me any advices?

    Thanks!
    Thao.

    ReplyDelete