在AWS上运行harp.js.

时间:2018-04-06 16:38:43

标签: node.js amazon-web-services package.json harp

我在AWS上基于node.js设置了一个Elastic Beanstalk实例,我试图让它运行harp.js。

使用此Procfile在Heroku上运行正常: !

但在AWS上,没有Procfile(据我所知),所以我将root中的package.json文件更改为以下内容:

web: harp server --port $PORT

这似乎不起作用。在服务器日志中,我最终得到:

   {
     "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 网站的情况下运行它时,我在根网站上收到了502 Bad Gateway错误。我去了我认为的默认端口,并且超时了。

1 个答案:

答案 0 :(得分:0)

您需要使用root访问权限运行它才能使用端口80

您可以将启动脚本更改为:

"scripts": {
  "start": "sudo harp server --port 80"
}