我在 AWS 上基于 node.js 设置了一个 Elastic Beanstalk 实例,并试图让它运行 harp.js。
使用这个 Procfile 在 Heroku 上运行良好:
web: harp server --port $PORT
但是在 AWS 上,没有 Procfile(据我所知),所以我将根目录中的 package.json 文件更改为以下内容:
{
"name": "Marketing-Website",
"version": "1.0.0",
"description": "My App",
"dependencies": {
"harp": "*"
},
"scripts": {
"start": "harp server --port 80"
}
}
这似乎不起作用。在服务器日志中,我最终得到:
-------------------------------------
/var/log/nodejs/nodejs.log
-------------------------------------
npm ERR! If you do, this is most likely a problem with the Marketing-Website package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! harp server --port 80
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Marketing-Website
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Marketing-Website
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
> Marketing-Website@1.0.0 start /var/app/current
> harp server --port 80
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EACCES 0.0.0.0:80
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1249:19)
at listen (net.js:1298:10)
at net.js:1408:9
at _combinedTickCallback (internal/process/next_tick.js:83:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3
npm ERR! Linux 4.9.85-38.58.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.12.2-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.12.2-linux-x64/bin/npm" "start"
npm ERR! node v6.12.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! Marketing-Website@1.0.0 start: `harp server --port 80`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Marketing-Website@1.0.0 start script 'harp server --port 80'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Marketing-Website package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! harp server --port 80
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Marketing-Website
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls Marketing-Website
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
> Marketing-Website@1.0.0 start /var/app/current
> harp server --port 80
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EACCES 0.0.0.0:80
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at Server._listen2 (net.js:1249:19)
at listen (net.js:1298:10)
at net.js:1408:9
at _combinedTickCallback (internal/process/next_tick.js:83:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3
当我在没有--port 80
构建网站的情况下运行它时,但在根网站上出现 502 Bad Gateway 错误。我去了我认为是默认端口的地方,这对我来说超时了。