fetch is not a function
Author: cmdparkourCreated Jul 4, 2025Updated Feb 14, 2026
Labelsbug
when i install node-fetch and using const fetch = require('node-fetch'); but when i using the fetch, it's wrong, and the message is fetch is not a function
Reproduction
Steps to reproduce the behavior:
const nodefetch = require('node-fetch');
const siteInfoRes = await nodefetch(fetchUrl, {
method: 'GET',
headers: {
'Authorization': Bearer ${TOKEN}
},
params: {
siteId: SITE_ID,
}
});
Expected behavior
Screenshots
Your Environment
| software | version |
|---|---|
| node-fetch | 3.3.2 |
| node | 22.16.0 |
| npm | usnig pnpm the last version |
| Operating System |
Additional context
Source: node-fetch/node-fetch