logging – winston circular declaration in node.js
i didn’t declare winston in the index.js but have declared in the other files which have been required in the index.js when i try to declare it and use the error displayed was ‘winston already declared’ so tried using winston without declaring it but the error stayed the same how do i use winston.info in this situation to log.
C:\Users\Thanushik Saravanan\node-training\first-app\startup\logging.js:2
const winston = require(‘winston’);
^
SyntaxError: Identifier ‘winston’ has already been declared
at wrapSafe (node:internal/modules/cjs/loader:1378:20)
at Module._compile (node:internal/modules/cjs/loader:1428:41)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object. (C:\Users\Thanushik Saravanan\node-training\first-app\index.js:6:1)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
Node.js v20.18.0
Read more here: Source link
