gpt4 book ai didi

node.js - 无法在 ubuntu 中启动 Node 服务器

转载 作者:太空宇宙 更新时间:2023-11-04 01:02:24 26 4
gpt4 key购买 nike

我正在尝试在 ubuntu 服务器中部署我的 Node + Express js 应用程序。但是在我的项目文件夹中执行 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"
}
}

最佳答案

根据您发布的错误,您的 Ubuntu 服务器上有 Node v0.6.12,它非常旧。 NodeMailer 需要 Node >= 0.10.0 才能工作。令我惊讶的是,npm 竟然允许您安装 NodeMailer,但这也是 npm 的一个非常旧的版本,因此它可能还没有进行版本检查。

您需要更新 Node 版本。

关于node.js - 无法在 ubuntu 中启动 Node 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25990110/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com