In this lesson, we introduce modules: what they are and how to use them. You'll learn: how to create a simple module and export the functions to be accessed elsewhere how to include code from your module in files within your application the three rules node uses to find the modules you require the hierarchy node uses to determine which modules take precedence which file extensions node can automatically detect when requiring modules
If we use: var colors = require('colors') And in my folder has following file: /colors.js /node_modules/colors
Which one is treated as require object?
Take a look at this. It should explain it: https://nodejs.org/api/modules.html#modules_all_together