How to solve when i want to start the server an error occured this error is Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()

PS C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node> node index.js
Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()
{“date”:“Tue Aug 16 2022 14:19:43 GMT+0300 (East Africa Time)”,“error”:{},“exception”:true,“level”:“error”,“message”:“uncaughtException: Invalid transport, must be an object with a log method.\nError: Invalid transport, must be an object with a log method.\n at new LegacyTransportStream (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston-transport\legacy.js:18:11)\n at DerivedLogger.add (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston\lib\winston\logger.js:352:11)\n at Object.exports. [as add] (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston\lib\winston.js:105:68)\n at module.exports (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\startup\logging.js:15:11)\n at Object. (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\index.js:6:29)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)\n
at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)”,“os”:{“loadavg”:[0,0,0],“uptime”:187781},“process”:{“argv”:[“C:\Program Files\nodejs\node.exe”,“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\index.js”],“cwd”:“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node”,“execPath”:“C:\Program Files\nodejs\node.exe”,“gid”:null,“memoryUsage”:{“arrayBuffers”:196067,“external”:1742421,“heapTotal”:17784832,“heapUsed”:11223264,“rss”:39059456},“pid”:20936,“uid”:null,“version”:“v16.15.0”},“stack”:“Error: Invalid transport, must be an object with a log method.\n at new LegacyTransportStream (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston-transport\legacy.js:18:11)\n at DerivedLogger.add (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston\lib\winston\logger.js:352:11)\n at Object.exports. [as add] (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston\lib\winston.js:105:68)\n at module.exports (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\startup\logging.js:15:11)\n at Object. (C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\index.js:6:29)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)\n at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)”,“trace”:[{“column”:11,“file”:“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston-transport\legacy.js”,“function”:“new LegacyTransportStream”,“line”:18,“method”:null,“native”:false},{“column”:11,“file”:“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston\lib\winston\logger.js”,“function”:“DerivedLogger.add”,“line”:352,“method”:“add”,“native”:false},{“column”:68,“file”:“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\node_modules\winston\lib\winston.js”,“function”:“Object.exports. [as add]”,“line”:105,“method”:“ [as add]”,“native”:false},{“column”:11,“file”:“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\startup\logging.js”,“function”:“module.exports”,“line”:15,“method”:“exports”,“native”:false},{“column”:29,“file”:“C:\Users\Eng Abdirizak Ahmed\Documents\gabi\vidly-api-node\index.js”,“function”:null,“line”:6,“method”:null,“native”:false},{“column”:14,“file”:“node:internal/modules/cjs/loader”,“function”:“Module._compile”,“line”:1105,“method”:“_compile”,“native”:false},{“column”:10,“file”:“node:internal/modules/cjs/loader”,“function”:“Module._extensions…js”,“line”:1159,“method”:“.js”,“native”:false},{“column”:32,“file”:“node:internal/modules/cjs/loader”,“function”:“Module.load”,“line”:981,“method”:“load”,“native”:false},{“column”:12,“file”:“node:internal/modules/cjs/loader”,“function”:“Module._load”,“line”:822,“method”:“_load”,“native”:false},{“column”:12,“file”:“node:internal/modules/run_main”,“function”:“Function.executeUserEntryPoint [as runMain]”,“line”:77,“method”:“executeUserEntryPoint [as runMain]”,“native”:false}]}

Hi,

Is your code running anyway ?

If so ignore the message as it seems to be more of a warning than it would be an error.

This is simply informative message to tell you that .handleExceptions() is deprecated and removed in a future version. This is so that you find an alternative by then. The nicest messages just tell you what to do instead (sometimes even providing links) but that’s not always the case.

So the only thing for now is : is it running ?

Regards

no my code is not running away
i solved this issue but another comes this issue is winston: exitOnError cannot be true with no exception handlers.

Did you replace .handleExceptions() with .exceptions.handle() as suggested by the message?

Yes i reaplaced .handleExceptions() with .exceptions.handle()

I also got the same error in nodejs. can anyone help? i replaced .handleExceptions() with .exceptions.handle() but it can’t handle promise rejection with winston

What is the name of the file that you reaplaced .handleExceptions() with .exceptions.handle() ?

I still have this issue and after spending hours and hours couldn’t solve. I appreciate any help

I encountered a similar issue, and this solution worked for me as well. Update your code by replacing .handleExceptions() with winston.exceptions.handle() .

Ensure compatibility with the versions you are using, particularly Node.js v20.10.0 and Winston v3.11.0.