This package, `http-agent`, is a deprecated and abandoned Node.js library designed to perform sequences of HTTP requests. Last published 15 years ago (July 15, 2011) at version 0.1.2, it targeted very early Node.js environments (>= 0.2.0). It was built upon the now-deprecated `request` library, leveraging it to allow for simple or complex request sequences, including an iterator pattern for dynamic control flow during web crawling. Due to its extreme age and reliance on obsolete dependencies and Node.js versions, it is not suitable for modern applications. There is no active maintenance, nor a release cadence. Modern alternatives like `axios`, `node-fetch`, or Node.js's built-in `fetch` API are highly recommended for current projects, offering better performance, security, and promise-based APIs.
npm install http-agentVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing an HTTP agent, defining a sequence of requests, and handling 'next' and 'stop' events.
Migrate to a modern HTTP client library like `axios`, `node-fetch`, or Node.js's built-in `fetch` API.
Replace `http-agent` with a currently maintained and secure HTTP client.
Use `const Agent = require('http-agent');` in CJS files. For ESM projects, migration to a modern ESM-compatible library is necessary.Consider re-implementing request sequencing with `async/await` and modern libraries for cleaner, more readable code.
Discontinue use immediately and migrate to a secure, actively maintained alternative.
Ensure your file is a CommonJS module (e.g., by using `.cjs` extension or setting `"type": "commonjs"` in `package.json` for older Node.js versions) and use `const Agent = require('http-agent');`. Better yet, migrate to an ESM-compatible HTTP client.First, try `npm install request`. If the error persists, it's a strong indicator of incompatibility. Migration to a modern HTTP client is the recommended solution.
Verify that `require('http-agent')` successfully returns the module. Ensure you are calling `Agent.create()` and not attempting to instantiate `Agent` with `new` or calling `create` as a top-level function.