Registry / devops / fetch-everywhere

fetch-everywhere

JSON →
library1.0.5jsnpmunverified

Isomorphic WHATWG Fetch API that works in node.js, browsers, webpack, browserify, and react-native by providing a global fetch function. Version 1.0.5, last updated in 2016. Built on top of isomorphic-fetch and GitHub's WHATWG Fetch polyfill. Key differentiator: claims to support all JavaScript environments without per-environment configuration. However, the package is minimally maintained and depends on the outdated isomorphic-fetch; modern Node.js versions (18+) include native fetch, making this polyfill obsolete for most use cases.

npm install fetch-everywhere
INSTALL
IMPORT
SIG · FETCH-EVERYWHERE
F
fetch-everywhere
devopsjavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fetch (global)
import 'fetch-everywhere'; fetch('...');
import { fetch } from 'fetch-everywhere';
This package sets fetch as a global, not a named export. In ESM, use a side-effect import. In CJS, require and call fetch globally.
require('fetch-everywhere')
require('fetch-everywhere'); fetch('...');
const fetch = require('fetch-everywhere');
The package does not export fetch; it only sets it globally. Assigned require will return an empty object.
Head, Request, Response, Body
import 'fetch-everywhere'; console.log(typeof Headers, typeof Request, typeof Response);
import { Headers } from 'fetch-everywhere';
These are also set globally, not exported. The package re-exports them from the underlying WHATWG polyfill.

Demonstrates fetching data from a public API after polyfilling Promise and importing fetch-everywhere to set global fetch.

require('es6-promise').polyfill(); require('fetch-everywhere'); fetch('https://jsonplaceholder.typicode.com/posts/1') .then(function(response) { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(function(post) { console.log(post.title); }) .catch(function(error) { console.error('Fetch failed:', error); });
Debug
Known issues
deprecatedPackage is outdated; modern Node.js (>=18) has native fetch. Use built-in fetch instead.
fix
In Node 18+, remove fetch-everywhere and use global fetch directly. For older environments, consider using 'node-fetch' (CJS) or 'undici' (ESM).
affects: all
breakingDoes not export fetch; it only applies fetch to global scope. Attempting to destructure import will result in undefined.
fix
Use a side-effect import (import 'fetch-everywhere') or require() without assignment.
affects: >=0.0.0
gotchaMust polyfill Promise manually if not available (e.g., Node 0.12). Package does not include a Promise polyfill.
fix
Install and polyfill es6-promise or promise before loading fetch-everywhere.
affects: all
gotchaDepends on 'isomorphic-fetch' which has known issues with binary data and streaming.
fix
Use 'node-fetch' for full Node.js spec-compliant fetch.
affects: all
deprecatedThe GitHub repo is archived; no further updates or security fixes.
fix
Migrate to a maintained fetch polyfill or use native fetch.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: fetch is not a function
The package wasn't imported before calling fetch, or it was imported incorrectly (e.g., destructured).
fix
Ensure you have a side-effect import: require('fetch-everywhere') or import 'fetch-everywhere' at the top of your entry file.
Cannot find module 'es6-promise'
fetch-everywhere requires es6-promise for older environments but does not include it as a dependency.
fix
Run: npm install es6-promise
ReferenceError: fetch is not defined
Trying to use fetch in a browser that doesn't support it or before the polyfill is loaded.
fix
Import fetch-everywhere at the entry point of your application before any fetch calls.
Warning: fetch-everywhere is deprecated. Please use native fetch or a modern alternative.
The package is no longer maintained and is not recommended for new projects.
fix
Remove fetch-everywhere and use native fetch (Node 18+) or node-fetch.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
es6-promiseoptionalRequired for Promise polyfill in environments without native Promise support (e.g., older Node). fetch-everywhere does not bundle a promise polyfill.
Agent activity
2 hits · last 30 days
node
2
Resources
fetch-everywhere — npm install fetch-everywhere · libregistry