Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

node-fetch

Browser-style fetch() for older Node.js code.

HTTP clients and networkingNPM

GitHubWebsite

1. License

“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”

MIT allows use in paid and closed-source products.

github.com/node-fetch/node-fetch/blob/main/LICENSE.md

From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error

What node-fetch does

node-fetch lets a Node.js program load web pages and call online services with fetch(), the same command web pages use. Node.js 18 and newer has fetch() built in, so today it mostly keeps older projects working. It is free under the MIT license.

What people build with it

Read data from an online service

Your server script asks another service for data, like a list of products, and gets it back as a ready object.

Send form or order data onward

When a visitor submits a form, your server passes the details on to another service, for example a mailing list or a shop system.

Save a large download to disk

Your server downloads a big file, like a report or a video, and writes it to disk piece by piece instead of holding it all in memory.

Give up on slow requests

A partner service sometimes hangs; your code cancels the request after a set time and shows a friendly error instead of waiting forever.

Read every cookie a server sets

A test or a login helper needs each Set-Cookie line a server sends; node-fetch gives them as a list.

Keep an older project working

An older app that still uses require() keeps its web requests working on the version 2 line while you plan an upgrade.

node-fetch popularity

75 / 100
Gid Score, #203 overall
301M
downloads a week, npm
8,845
GitHub stars
106
agent projects use it
node-fetch: downloads per weeknpm, node-fetch 300,609,978
node-fetch: GitHub starsnode-fetch/node-fetch 8,845

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How node-fetch is used

  • node-fetch is a dependency in 106 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (2.2% of the 4,867 JavaScript/TypeScript ones), #10 of 126 in http clients and networking.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 390; those are left out of every share on this page.
  • The most used alternative in our scan is Axios (470 projects).
  • Projects that use it most often also use dotenv (67.9%), Axios (34.0%), Express (31.1%).

By coding agent

63 projects, 2.6%
49 projects, 1.6%
42 projects, 1.3%
9 projects, 1.9%
7 projects, 2.1%
7 projects, 2.5%
6 projects, 1.3%
5 projects, 1.5%

Often used with

In 67.9% of its projects
In 34.0% of its projects
In 31.1% of its projects
In 34.0% of its projects
In 34.9% of its projects
In 77.4% of its projects
In 26.4% of its projects
In 25.5% of its projects

More about node-fetch

Funding
  • GitHub Sponsors: https://github.com/node-fetch
  • Open Collective: https://opencollective.com/node-fetch
  • 5 GitHub sponsors

See all

Head to head
More in HTTP clients and networking

Alternatives

node-fetch This page

MITGid 75301M/wk

undici

Pick undici, the HTTP client from the Node.js project, when you want the same engine as Node's built-in fetch plus pooling and proxy options.

MITGid 76355M/wk

Axios

Pick axios when you want one client for browser and Node.js with request and response interceptors.

MITGid 9115M/wk

Ky

Pick ky when you like fetch but want retries, timeouts and JSON helpers on top, in the browser or Node.js.

cross-fetch

Universal WHATWG Fetch API implementation for Node, browsers and React Native.

MITGid 6053.9M/wk

Compare node-fetch with another tool

Get started

Tell your AI assistant

“On Node.js 18+ use the built-in fetch; only if this project must keep node-fetch, pin node-fetch@3.3.2 (ES modules) or node-fetch@2.7.0 (require), check response.ok, and cancel slow calls with an AbortController.”

  1. Add node-fetch to your project; version 3 needs Node.js 12.20 or newer.

    npm install node-fetch

    From github.com/node-fetch/node-fetch/blob/main/README.md

  2. Import it as an ES module. For a require() project, install node-fetch@2 instead.

    import fetch from 'node-fetch';

    From github.com/node-fetch/node-fetch/blob/main/README.md

  3. Treat error statuses yourself; a 404 or 500 does not throw, so check response.ok.

    From github.com/node-fetch/node-fetch/blob/main/README.md

Mistakes to avoid

const fetch = require('node-fetch') // with node-fetch 3
import fetch from 'node-fetch' (or the built-in fetch on Node.js 18+); for require() code install node-fetch@2

Version 3 is ESM-only and cannot be loaded with require().

fetch(url, { timeout: 5000 })
Pass signal from an AbortController and call controller.abort() after 5 seconds

The timeout option was dropped in version 3 because it is not part of the fetch standard.

try { await fetch(url) } catch { /* treat as failed */ } and nothing else
Also check response.ok (or response.status) and handle 4xx and 5xx answers

Error statuses do not throw; only network and operational errors do.

fetch('/api/users')
fetch(new URL('/api/users', baseUrl))

Only absolute addresses work on the server.

npm install node-fetch in a new project on Node.js 18 or newer
Use the global fetch that Node.js provides

Node.js has shipped fetch without a flag since version 18, and node-fetch has had no release since 2023.

Questions

Do I still need node-fetch?

Usually not on Node.js 18 or newer, which has fetch() built in. It still helps older Node.js versions and code that uses its extras.

Why does require('node-fetch') fail?

Version 3 is ESM-only. Use import, a dynamic import(), or install version 2.

How do I set a timeout?

The old timeout option was removed in version 3; pass an AbortController's signal and abort it after the time you choose.

Why did a 404 not throw an error?

Error statuses are normal responses; check response.ok or response.status yourself.

Can I call a relative address like /api/users?

No. Give a full address such as https://example.com/api/users; relative ones are rejected.