NodeJs : TypeError: require(…) is not a function

前端 未结 7 907
旧巷少年郎
旧巷少年郎 2020-11-27 15:27

I am trying to require a file and afterwards pass it to a var. I am following this tutorial to create a authentication system. After writing the server.js file and trying to

7条回答
  •  感情败类
    2020-11-27 16:12

    For me, this was an issue with cyclic dependencies.

    IOW, module A required module B, and module B required module A.

    So in module B, require('./A') is an empty object rather than a function.

    How to deal with cyclic dependencies in Node.js

提交回复
热议问题