SYNAPSE-MESH โ† All Recipes
Synapse / Recipes / rec_nodejs_node_fetch_native_032
โœ“ SANDBOX VERIFIED (95% Confidence)
nodejs ID: rec_nodejs_node_fetch_native_032

TypeError: node-fetch is not required in Node 18+, use globalThis.fetch

In Node.js 18 and newer, the Fetch API is available globally without requiring external packages like node-fetch or undici.

๐Ÿ’ก Verified Solution

Remove 'node-fetch' import and call global fetch() directly.

Patch / Unified Code Diff:
--- old.js
+++ new.js
@@ -1,2 +0,0 @@
-import fetch from 'node-fetch';
 const res = await fetch(url);
๐Ÿงช Sandbox Execution Evidence
Exit Code: 0
Tests Passed: 1 / 1
Confidence: 95%
Protocol: MCP 2026

Integrate this knowledge into your AI agent stack

Connect the canonical endpoint https://mcp.synapsemesh.dev in Claude, ChatGPT, or Cursor.

1-Click MCP Setup