【问题标题】:Failed at the messenger-get-started@1.0.0 start script 'node app.js在 messenger-get-started@1.0.0 启动脚本 'node app.js 失败
【发布时间】:2017-03-17 03:59:34
【问题描述】:

我的服务器在本地运行良好,但是当我在部署到 amazon ec2 后启动服务器时,它会引发以下错误: 这个解决方案对我来说不够用https://github.com/fbsamples/messenger-platform-samples/issues/43

node dist/app.js

节点分布/app.js

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::3979
    at Object.exports._errnoException (util.js:907:11)
    at exports._exceptionWithHostPort (util.js:930:20)
    at Server._listen2 (net.js:1250:14)
    at listen (net.js:1286:10)
    at Server.listen (net.js:1382:5)
    at EventEmitter.listen (/var/www/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/var/www/dist/app.js:120:6)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)

npm ERR! Linux 3.13.0-44-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.8.0
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! mychatapp@1.0.0 start: `node dist/app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mychatapp@1.0.0 start script 'node dist/app.js'.
npm ERR! This is most likely a problem with the mychatapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node dist/app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs mychatapp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls mychatapp
npm ERR! There is likely additional logging output above.

怀疑没有加载process.env,我什至尝试硬编码以下值,但结果是一样的。

const VALIDATION_TOKEN = '3f92bb17caf0e11f5632920a402e1687'

const PAGE_ACCESS_TOKEN = 'EAAN9j2KfDg0BAIUrb8ZCaPmgHQXyO88mR55X40gWSJ8gi0CagZC0bJ0wZCETTVFSIUHLC7Fr58O9q8JHrQYFtc1vT2ksjPxV2Z34dqZAUiZCfpyInRa24EyvZABvpK72nooh86TUCVlYn1F9njjIWlDVfvbNw481nZCvOOW0T5EOZAQZDZD'

const SERVER_URL = 'http://http://ec2-54-220-173-191.us-west-

【问题讨论】:

  • nodejs EADDRINUSE error的可能重复
  • lsof -i :3979 -> kill -1 pid_shown_by_previous_command 并再次运行您的应用程序。

标签: node.js amazon-ec2 facebook-chatbot


【解决方案1】:

问题在于服务器已经在运行, 错误:监听 EADDRINUSE :::3979

在部署脚本中添加pkill -f node 在启动节点服务器之前解决了问题

【讨论】:

    猜你喜欢
    • 2019-06-07
    • 1970-01-01
    • 2016-11-01
    • 1970-01-01
    • 2017-02-08
    • 2019-09-02
    • 2018-04-29
    • 2018-05-09
    • 2019-03-27
    相关资源
    最近更新 更多