node-fetch
Browser-style fetch() for older Node.js code.
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.md3. Used by agents' projects
Dependency in 106 public GitHub projects set up for AI coding agents that we scanned (1.7%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
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
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
Often used with
More about node-fetch
Funding
- GitHub Sponsors: https://github.com/node-fetch
- Open Collective: https://opencollective.com/node-fetch
- 5 GitHub sponsors
Head to head
- Axios vs node-fetch used together in 36 projects
More in HTTP clients and networking
Alternatives
node-fetch This page
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.
Pick axios when you want one client for browser and Node.js with request and response interceptors.
Pick ky when you like fetch but want retries, timeouts and JSON helpers on top, in the browser or Node.js.
Universal WHATWG Fetch API implementation for Node, browsers and React Native.
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.”
Add node-fetch to your project; version 3 needs Node.js 12.20 or newer.
npm install node-fetchImport it as an ES module. For a require() project, install node-fetch@2 instead.
import fetch from 'node-fetch';Treat error statuses yourself; a 404 or 500 does not throw, so check response.ok.
Mistakes to avoid
Version 3 is ESM-only and cannot be loaded with require().
The timeout option was dropped in version 3 because it is not part of the fetch standard.
Error statuses do not throw; only network and operational errors do.
Only absolute addresses work on the server.
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.