无法在ubuntu中启动节点服务器

时间:2014-09-23 08:11:18

标签: node.js ubuntu express

我正在尝试在ubuntu服务器中部署我的node + express js app。但是在我的项目文件夹中执行npm start时,我得到:

 > project1@0.0.1 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! project1@0.0.1 start: `node ./bin/www`
npm ERR! `sh "-c" "node ./bin/www"` failed with 1
  npm ERR! 
 npm ERR! Failed at the project1@0.0.1 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 project1@0.0.1 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

现在,我没有明确地使用本地计算机中的域模块(尽管nodemailer正在使用)。即便如此我安装了域模块,但错误仍然存​​在。请帮帮我

编辑1:

我的包json文件:

      {
  "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 个答案:

答案 0 :(得分:1)

根据您发布的错误,您的Ubuntu服务器上有节点v0.6.12,这是超级旧的。 NodeMailer需要节点>= 0.10.0才能工作。我很惊讶npm让你完全安装NodeMailer,但这又是npm的旧版本,所以它可能还没有进行版本检查。

您需要更新节点版本。

答案 1 :(得分:0)

现在通过重新安装node和express来运行应用程序。不知道为什么它现在正在运行。

相关问题