talmobi / tor-request

light Tor proxy wrapper for request library
http://tor.jin.fi/
311 stars 43 forks source link

always get error (SocksClientError: connect ECONNREFUSED 127.0.0.1:9050) #60

Open Pavelhack opened 4 years ago

Pavelhack commented 4 years ago

after installing and running the module, I get an error from a function of one of the dependencies. (socksclient.js: 371: 32). Maybe it dependence(module"socksclient") did`t work correct now?

talmobi commented 4 years ago

Can you see the full error log where it says:

(node:95146) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:9050

 - Are you running `tor`?
See easy guide here (OSX, Linux, Windows):
https://github.com/talmobi/tor-request#requirements

 Quickfixes:
  OSX: `brew install tor && tor`         # installs and runs tor
  Debian/Ubuntu: `apt-get install tor`   # should auto run as daemon after install
  Windows: download the Windows Expert Bundle from `https://www.torproject.org/download/tor/`
           Unzip and run tor.exe inside the Tor/ directory.

See the: https://github.com/talmobi/tor-request#requirements

talmobi commented 4 years ago

see related issues: https://github.com/talmobi/tor-request/issues/3 https://github.com/talmobi/tor-request/issues/40 https://github.com/talmobi/tor-request/issues/54

Basically you have most likely forgot to run your tor client before using tor-request

DhananjayPurohit commented 1 year ago

I am getting the same error even when my tor is running:-

netstat -ano | find "9060"
  TCP    127.0.0.1:9060         0.0.0.0:0              LISTENING       7804
tasklist /fi "pid eq 7804"
Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
tor.exe                       7804 Console                    1     40,648 K

OS:- Windows 11

Here's the link to my torrc file:- https://gist.github.com/DhananjayPurohit/40d377e67e5ac7bf5f0f3b86717fdd77

DhananjayPurohit commented 1 year ago

@talmobi @Pavelhack

talmobi commented 1 year ago

@DhananjayPurohit tor is usually running on port 9050 by default -- but your seems to be running on port 9060 -- try setting the port specifically to 9060 using

var tr = require('tor-request');
var ipaddress = "127.0.0.1"
var port = 9060
tr.setTorAddress(ipaddress, port); // "127.0.0.1" and 9050 by default
DhananjayPurohit commented 1 year ago

I ensured the port to be 9060 still getting the error, Is there any tool or process you can recommend for checking what's wrong with my SOCKS port?

talmobi commented 1 year ago

@DhananjayPurohit maybe there is wrong with library configuring the port -- try running your tor on port 9050 instead by changing line 18 in your torrc and trying again.

you can check which ports are active/in use using:

lsof -i -P -n | grep LISTEN