1
votes

I am trying to deploy my node + express js app in ubuntu server. But on executing npm start in my project folder, I get:

 > [email protected] start /data/node/organization-social-network/organizationconnect
 > node ./bin/www


 node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
  Error: Cannot find module 'domain'
  at Function._resolveFilename (module.js:332:11)
  at Function._load (module.js:279:25)
  at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.nodeRequire (/data/node/node_modules/nodemailer/node_modules/aws-         sdk/lib/util.js:39:31)
at Object.<anonymous> (/data/node/node_modules/nodemailer/node_modules/aws-sdk/lib/sequential_executor.js:2:23)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)

npm ERR! [email protected] start: `node ./bin/www`
npm ERR! `sh "-c" "node ./bin/www"` failed with 1
  npm ERR! 
 npm ERR! Failed at the [email protected] start script.
 npm ERR! This is most likely a problem with the project1 package,
 npm ERR! not with npm itself. 
 npm ERR! Tell the author that this fails on your system: 
 npm ERR!     node ./bin/www
 npm ERR! You can get their info via:
 npm ERR!     npm owner ls project1
 npm ERR! There is likely additional logging output above.
 npm ERR! 
 npm ERR! System Linux 3.2.0-25-virtual
 npm ERR! command "node" "/usr/bin/npm" "start"
 npm ERR! cwd /data/node/organization-social-network/organizationconnect
 npm ERR! node -v v0.6.12
 npm ERR! npm -v 1.1.4
 npm ERR! code ELIFECYCLE
 npm ERR! message [email protected] start: `node ./bin/www`
 npm ERR! message `sh "-c" "node ./bin/www"` failed with 1
 npm ERR! errno {}
 npm ERR! 
 npm ERR! Additional logging details can be found in:
 npm ERR!     /data/node/organization-social-network/organizationconnect/npm-debug.log
 npm not ok

Now, I am not using domain module in my local machine explicitely (nodemailer is using though). Even then I installed domain module but the error persists. Please help me out

Edit 1:

My package json file:

      {
  "name": "project1",
  "version": "0.0.1",
  "private": true,
   "scripts": {
   "start": "node ./bin/www"
   },
  "dependencies": {
     "express": "~4.2.0",
     "static-favicon": "~1.0.0",
     "morgan": "~1.0.0",
     "cookie-parser": "~1.0.1",
    "body-parser": "~1.0.0",
    "debug": "~0.7.4",
     "jade": "~1.3.0",
  "socket.io": "*",
   "express-sessions":"latest",
   "session-middleware":"latest"
 }
 }
2
check what is entry point of the app by going to package.json. Check if that file is present - Mithun Satheesh
I have updated my post with package.json. Please note that the same code is running in my local machine with same folder structure - user746458

2 Answers

1
votes

From the error that you posted, your Ubuntu server has Node v0.6.12 on it, which is super old. NodeMailer requires Node >= 0.10.0 in order to work. I'm surprised that npm let you install NodeMailer at all, but again that's a very old version of npm so it might not have had version checking yet.

You'll need to update your node version.

0
votes

The application is running now by reinstalling node and express. No clue why its running now.