I'm building a URL shortener app in Node.js (v20.16.0) using Express.
In my controller/user.js, I try to import uuid like this:
const { v4: uuidv4 } = require('uuid');
But when I run npm start, I get this error:
Error [ERR_REQUIRE_ESM]: require() of ES Module
D:\NodeJs\short-url\node_modules\uuid\dist\index.js
from D:\NodeJs\short-url\controller\user.js not supported.