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

Node.js best-practice: use 'node:' protocol prefix for core built-in module imports

Node.js 16+ recommends using the 'node:' prefix for all built-in module imports (e.g. 'node:fs', 'node:path') to avoid npm package shadowing.

๐Ÿ’ก Verified Solution

Prefix all core imports with 'node:' (e.g., import path from 'node:path').

Patch / Unified Code Diff:
--- old.js
+++ new.js
@@ -1,2 +1,2 @@
-import fs from 'fs';
-import path from 'path';
+import fs from 'node:fs';
+import path from 'node:path';
Official Primary Reference: https://nodejs.org/api/esm.html#node-imports
๐Ÿงช 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