{"id":17952,"library":"socks5-http-client","title":"SOCKS5 HTTP Client for Node.js","description":"This package provides a SOCKS v5 HTTP client implementation specifically for Node.js environments. It enables making HTTP requests through a SOCKS5 proxy, commonly used for anonymizing traffic via services like Tor. The current stable version is 1.0.4, last published over eight years ago (July 2018). The library focuses solely on HTTP, explicitly directing users to a separate `socks5-https-client` package for HTTPS. Its primary differentiators were its straightforward integration with the deprecated `request` library and its direct support for SOCKS5 proxying, including authentication. Due to its age and lack of updates, it is largely incompatible with modern Node.js versions and lacks contemporary features like Promise-based APIs.","status":"abandoned","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/mattcg/socks5-http-client","tags":["javascript","socks5","socksv5","socks","v5","http","tor","client"],"install":[{"cmd":"npm install socks5-http-client","lang":"bash","label":"npm"},{"cmd":"yarn add socks5-http-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add socks5-http-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core SOCKS5 socket implementation; also an old, unmaintained package.","package":"socks5-client","optional":false}],"imports":[{"note":"This package is CommonJS only. Attempting to use ES module import syntax will result in an error.","wrong":"import shttp from 'socks5-http-client';","symbol":"shttp","correct":"const shttp = require('socks5-http-client');"},{"note":"The `Agent` constructor for integrating with `http.request` or deprecated libraries like `request` is found in a sub-path and is CommonJS only.","wrong":"import { Agent } from 'socks5-http-client/lib/Agent';","symbol":"Agent","correct":"const Agent = require('socks5-http-client/lib/Agent');"},{"note":"The main client object `shttp` is a default-like export; methods like `get` are accessed directly on the `shttp` object, not destructured.","wrong":"const { get } = require('socks5-http-client');","symbol":"get","correct":"const shttp = require('socks5-http-client'); shttp.get('http://example.com', () => {});"}],"quickstart":{"code":"const shttp = require('socks5-http-client');\n\nconst SOCKS_HOST = process.env.SOCKS_HOST ?? 'localhost';\nconst SOCKS_PORT = parseInt(process.env.SOCKS_PORT ?? '1080', 10);\n\nshttp.get({\n  hostname: 'www.example.com',\n  path: '/',\n  socksHost: SOCKS_HOST,\n  socksPort: SOCKS_PORT,\n  // Optional SOCKS5 authentication\n  // socksUsername: process.env.SOCKS_USERNAME,\n  // socksPassword: process.env.SOCKS_PASSWORD,\n}, function(res) {\n  res.setEncoding('utf8');\n  let data = '';\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n  res.on('end', function() {\n    console.log('Received response:');\n    console.log(data.substring(0, 200) + '...'); // Log first 200 chars\n  });\n}).on('error', (e) => {\n  console.error(`Request failed: ${e.message}`);\n});","lang":"javascript","description":"This example demonstrates how to make a basic HTTP GET request through a SOCKS5 proxy configured via environment variables, logging the initial part of the response body."},"warnings":[{"fix":"Migrate to a actively maintained SOCKS5 client library for Node.js, such as `socks-proxy-agent` or explore `node-fetch` with a custom agent.","message":"The package is severely unmaintained, with the last publish over eight years ago. It is known to be broken for Node.js versions above 14.17.0 due to internal compatibility issues, making it unsuitable for modern Node.js applications.","severity":"breaking","affected_versions":">=1.0.4"},{"fix":"Do not use this package for new projects or in security-sensitive environments. Replace with a well-maintained and audited SOCKS5 client.","message":"Being an unmaintained SOCKS5 client, this package may contain unpatched security vulnerabilities. SOCKS5 implementations have been susceptible to heap buffer overflows (e.g., CVE-2023-38545 in curl) and other issues. Using this library in production is a significant security risk.","severity":"security","affected_versions":">=1.0.0"},{"fix":"For HTTPS, you must use a different library. If you need a combined solution, look for more comprehensive proxy agents.","message":"This client explicitly supports only HTTP requests, not HTTPS. For HTTPS traffic over SOCKS5, the separate `socks5-https-client` package (also unmaintained) or a modern alternative is required.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid integrating with the deprecated `request` library. If using this package, use it directly with Node's native `http` module or choose a modern HTTP client with SOCKS support.","message":"The recommended integration path for `socks5-http-client` involves passing its `Agent` to the `request` library, which itself was fully deprecated in February 2020. This indicates an outdated ecosystem reliance.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Stick to `require()` syntax for importing this package. For modern applications, consider libraries that offer native ESM support.","message":"This package is written exclusively in CommonJS (CJS) and does not support ES module (ESM) import syntax (`import ... from '...'`). Attempting to use ESM imports will lead to runtime errors in modern Node.js environments.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure `npm install` has been run in your project root, or check your `NODE_PATH` environment variable if using global modules. This can also indicate issues with older Node.js versions.","cause":"The core dependency `socks5-client` was not installed correctly or Node.js cannot resolve its path.","error":"Error: Cannot find module 'socks5-client'"},{"fix":"This package is not compatible with modern Node.js versions (specifically, likely >14.17.0). Downgrade Node.js or, preferably, migrate to a current, maintained SOCKS5 client library.","cause":"This error often occurs in older stream implementations (like those in this package) when interacting with newer Node.js stream APIs or versions where internal stream properties have changed.","error":"TypeError: Cannot set property 'flowing' of undefined"},{"fix":"Verify that `socksHost` and `socksPort` are correct. Ensure the SOCKS5 proxy is running and accessible from the machine running the Node.js application. Check firewall rules.","cause":"The client could not establish a connection to the specified SOCKS5 proxy server, usually due to incorrect `socksHost`/`socksPort` settings, the proxy server not running, or network firewall rules.","error":"RequestError: Error:connect ETIMEDOUT occurred with some socks5 server"},{"fix":"This package is abandoned and incompatible with recent Node.js versions. Upgrade to a modern, actively maintained SOCKS proxy agent (e.g., `https-proxy-agent` or `socks-proxy-agent`).","cause":"Internal compatibility issues with Node.js changes post-14.17.0, likely related to networking or stream APIs.","error":"Broken for node version above 14.17.0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}