Sunday, October 14, 2018

NodeJS cleanup: clean cache or delete node_modules

From time to time node_modules accumulate changes that either delay execution or even make the program miss behave. It is a good idea from time to time to clean cache:
npm cache clean --force
Or perhaps better
rm -fr node_modules && npm i
Here is one of those cases I found that this procedure helped with. Note that this is not to say the below issue will 100% of the time be related to uncleaned node_modules:
(node:25899) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1) (node:25899) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Followers