node.js - deployed Nodejs REST API on AWS using elastic beanstalk - Error cannot find custom module -
i wrote first nodejs application. works fine on macbook when try deploy on aws elastic beanstalk,i below error .
/var/log/nodejs/nodejs.log
at function.module._load (module.js:310:12) @ module.require (module.js:365:17) module.js:338 throw err; ^ error: cannot find module '**./routes/userprofile**' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ object.<anonymous> (/var/app/current/main.js:7:18) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ module.require (module.js:365:17)
it seems nodejs not able resolve path custom module userprofile resides under routes directory.i have tried moving userprofile.js root, can still not resolve that.
this code in main.js loads modules
/ load our modules
var express = require('express'); var bodyparser = require('body-parser'); var userprofile = require('./routes/userprofile');
problem looks @ line require('./routes/userprofile')
does have idea , doing wrong? appreciate help.
thanks.
Comments
Post a Comment