// Use import instead of require. For example:
import fetch from "node-fetch";
This error is caused when you install the latest version of nanoID
To fix the problem follow these steps:
Uninstall nanoid:
npm uninstall nanoid
Install Version 3 supporting all 3.x.x:
npm install nanoid@^3.0.0
// mod.cjs
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));