vithalreddy/node-mailin

circular dependency warning on node v15.5

sachinbhutani opened this issue · 5 comments

I get the following circular dependency warnings when running on node version 15.5

(node:1585) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1585) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:1585) Warning: Accessing non-existent property 'which' of module exports inside circular dependency

Hey,

the message circular dependency indicates that one file is importing another file which in turn is importing the first one. It seems Node v15 no longer supports this.

Could you please run node --trace-warnings ... so we can see where the error is coming from?

Full trace but only the first warning got expanded
seems like the issue is in one another dependency library

(node:1066) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.exports.setLevels (/Users/sachin/sites/node-mailin/node_modules/winston/lib/winston/common.js:35:14)
    at Object.<anonymous> (/Users/sachin/sites/node-mailin/node_modules/winston/lib/winston.js:83:8)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
warn: Either spamassassin or spamc are not available. Spam score computation is disabled.
info: nodeMailin v2.1.1
info: Log file: /var/log/nodeMailin.log
info: Spam score computation is disabled
(node:1067) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1067) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:1067) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
info: NodeMailin Smtp server listening on port 25

info: nodeMailin v2.1.1

I just noticed you are not using the latest version of node-mailin. Try installing the latest version v2.4.0 and see if the error is coming up again.

I also can't reproduce the error on Node v15.5 with the latest version of node-mailin or the version you are using. Are you running it from the command line or inside a node application?

seems like the issue is in one another dependency library

Indeed, the error is coming from winston and was already reported in #1797 and fixed in 2.4.5.

thanks @BetaHuhn
I just did a git clone before running this.
I see package.json in #master branch has version 2.1.1, do you need to bump the version in #master ?
https://github.com/vithalreddy/node-mailin/blob/master/package.json
winston version in package.json is also 2.4.2

I see package.json in #master branch has version 2.1.1, do you need to bump the version in #master ?

Oh, yes it is. Will fix this later, thanks for pointing it out!

I just tried to use node-mailin on Node v15.5 by cloning it directly and can now reproduce your error. I will take a closer look at it tomorrow and make sure the version on NPM is the same as in this repo. Maybe @vithalreddy can help me with this as I don't have write access to the NPM package.

For now, the best thing to do is installing the latest version via NPM:

npm install -g node-mailin