I have 3 js files:
There is express server starts in server.js. app.js call server start from server.js. app.js is in root directory and there also is a src directory with server.js and utils.js. When I'm trying:
var utils = require('utils');
In server.js I get error:
Error: Cannot find module 'utils'
Why? utils.js and server.js are in the same directory.
Thank you.
You have to write:
require("./utils")
Otherwise it will try to load utils.js from the node_modules directory.