From f1242958e6233a2372fca1e96fe0a7075bf7918b Mon Sep 17 00:00:00 2001 From: Sulaiman3352 <32817650+Sulaiman3352@users.noreply.github.com> Date: Fri, 27 Feb 2026 23:28:49 +0300 Subject: [PATCH] fix the bug fix the next error massage: /app/src/routes/addItem.js:2 const {v4 : uuid} = require('uuid'); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /app/node_modules/uuid/dist-node/index.js from /app/src/routes/addItem.js not supported. Instead change the require of index.js in /app/src/routes/addItem.js to a dynamic import() which is available in all CommonJS modules. at Object. (/app/src/routes/addItem.js:2:21) at Object. (/app/src/index.js:5:17) { code: 'ERR_REQUIRE_ESM' } --- src/routes/addItem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/addItem.js b/src/routes/addItem.js index 90dfe06b3..625affc3f 100644 --- a/src/routes/addItem.js +++ b/src/routes/addItem.js @@ -1,9 +1,9 @@ const db = require('../persistence'); -const {v4 : uuid} = require('uuid'); +const crypto = require('crypto'); // Use Node's native crypto module module.exports = async (req, res) => { const item = { - id: uuid(), + id: crypto.randomUUID(), // Generates a standard v4 UUID name: req.body.name, completed: false, };