2014-09-23 125 views
1

我想在ubuntu服務器中部署我的節點+ express js應用程序。但是,在我的項目文件夾執行NPM開始,我得到:無法在ubuntu中啓動節點服務器

> [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 

現在,我不會在我的本地機器使用域模塊明確地(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" 
} 
} 
+0

轉到package.json,檢查應用程序的入口點。檢查該文件是否存在 – mithunsatheesh 2014-09-23 09:11:02

+0

我已經使用package.json更新了我的文章。請注意,相同的代碼在我的本地機器運行相同的文件夾結構 – user746458 2014-09-23 10:04:52

回答

1

從您發佈的錯誤,你的Ubuntu服務器節點v0.6.12就可以了,這是超級老。 NodeMailer需要節點>= 0.10.0才能工作。我很驚訝npm可以讓你安裝NodeMailer,但這又是一個非常舊的版本npm,所以它可能還沒有進行版本檢查。

您需要更新節點版本。

+0

嗨...我試圖更新節點版本,但它沒有奏效。所以我重新安裝了整個設置,現在應用程序運行良好。原因....我不知道......但迄今爲止這麼好... – user746458 2014-09-23 18:43:22

+0

那麼,它現在是節點的更新版本嗎?你從'node -v'得到什麼? – loganfsmyth 2014-09-23 18:53:32

+0

節點版本是0.6。另外,在我的本地機器節點版本是v0.8.2,我可以使用Gmail帳戶發送電子郵件 – user746458 2014-09-23 18:56:49

0

該應用程序現在正在通過重新安裝節點和express來運行。不知道爲什麼現在跑步。