Git部署无法启动应用程序不确定原因

我正在部署在与我的产品环境相同的临时环境中进行testing的代码。 代码正确部署在代码中,但之后无法部署在prod中。 我得到以下堆栈跟踪:

2017-01-10T03:57:42.481294+00:00 heroku[web.3]: Restarting 2017-01-10T03:57:42.482078+00:00 heroku[web.3]: State changed from up to starting 2017-01-10T03:57:42.558898+00:00 heroku[web.1]: Restarting 2017-01-10T03:57:42.559519+00:00 heroku[web.1]: State changed from up to starting 2017-01-10T03:57:42.574467+00:00 heroku[web.2]: Restarting 2017-01-10T03:57:42.574467+00:00 heroku[web.2]: State changed from up to starting 2017-01-10T03:57:43.096202+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2017-01-10T03:57:43.224722+00:00 heroku[web.1]: Process exited with status 0 2017-01-10T03:57:43.182174+00:00 heroku[web.3]: Stopping all processes with SIGTERM 2017-01-10T03:57:43.253740+00:00 heroku[web.2]: Stopping all processes with SIGTERM 2017-01-10T03:57:43.368835+00:00 heroku[web.2]: Process exited with status 0 2017-01-10T03:57:43.309209+00:00 heroku[web.3]: Process exited with status 0 2017-01-10T03:57:49.095054+00:00 heroku[web.1]: Starting process with command `node app.js` 2017-01-10T03:57:49.250082+00:00 heroku[web.2]: Starting process with command `node app.js` 2017-01-10T03:57:51.165665+00:00 app[web.2]: Required New Relic 2017-01-10T03:57:51.508858+00:00 app[web.1]: Required New Relic 2017-01-10T03:57:52.218712+00:00 app[web.2]: fs.js:844 2017-01-10T03:57:52.218722+00:00 app[web.2]: return binding.stat(pathModule._makeLong(path)); 2017-01-10T03:57:52.218722+00:00 app[web.2]: ^ 2017-01-10T03:57:52.218723+00:00 app[web.2]: 2017-01-10T03:57:52.218726+00:00 app[web.2]: Error: ENOENT: no such file or directory, stat '/app/node_modules/.bin/_mocha' 2017-01-10T03:57:52.218727+00:00 app[web.2]: at Error (native) 2017-01-10T03:57:52.218727+00:00 app[web.2]: at Object.fs.statSync (fs.js:844:18) 2017-01-10T03:57:52.218728+00:00 app[web.2]: at /app/node_modules/include-all/index.js:48:12 2017-01-10T03:57:52.218728+00:00 app[web.2]: at Array.forEach (native) 2017-01-10T03:57:52.218729+00:00 app[web.2]: at requireAll (/app/node_modules/include-all/index.js:44:9) 2017-01-10T03:57:52.218729+00:00 app[web.2]: at /app/node_modules/include-all/index.js:54:23 2017-01-10T03:57:52.218730+00:00 app[web.2]: at Array.forEach (native) 2017-01-10T03:57:52.218730+00:00 app[web.2]: at requireAll (/app/node_modules/include-all/index.js:44:9) 2017-01-10T03:57:52.218731+00:00 app[web.2]: at buildDictionary (/app/node_modules/sails-build-dictionary/index.js:68:14) 2017-01-10T03:57:52.218732+00:00 app[web.2]: at Array.async.auto.nodeModulesFolder (/app/node_modules/sails/lib/hooks/moduleloader/index.js:379:27) 2017-01-10T03:57:52.218731+00:00 app[web.2]: at Function.module.exports.optional (/app/node_modules/sails-build-dictionary/index.js:160:9) 2017-01-10T03:57:52.218732+00:00 app[web.2]: at /app/node_modules/sails/node_modules/async/lib/async.js:484:38 2017-01-10T03:57:52.218733+00:00 app[web.2]: at _each (/app/node_modules/sails/node_modules/async/lib/async.js:46:13) 2017-01-10T03:57:52.218734+00:00 app[web.2]: at Hook.bound [as loadUserHooks] (/app/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21) 2017-01-10T03:57:52.218733+00:00 app[web.2]: at Object.async.auto (/app/node_modules/sails/node_modules/async/lib/async.js:455:9) 2017-01-10T03:57:52.218734+00:00 app[web.2]: at Hook.loadUserHooks (/app/node_modules/sails/lib/hooks/moduleloader/index.js:363:13) 2017-01-10T03:57:52.309838+00:00 heroku[web.2]: State changed from starting to crashed 

它抱怨的软件包没有安装在正常工作的登台服务器上,所以我不确定这是否是错误。 (我也尝试在我的prod服务器上安装它)我很好奇,如果有人有任何想法我应该做的。

您的日志消息表明您的Heroku ./node_modules/.bin/_mocha试图运行命令./node_modules/.bin/_mocha 。 这个文件不存在,所以你的Heroku进程如果无法启动。

摩卡是JS的testing框架,所以我不知道为什么这将在生产中运行。

我会检查一些事情:

  1. 你的程序在哪里运行摩卡? 是否有必要在生产中运行它?
  2. 在你的Procfile ,你是否意外地告诉Heroku运行Mocha?
  3. 如果你真的需要运行摩卡 – 你有没有安装在你的package.json文件?
  4. 你正在运行的摩卡指令对我来说看起来不正确。 通常如果你想从NPM安装中运行mocha,你可以使用命令./node_modules/mocha/bin/mocha 。 如果你到了这一步,仍然没有工作,尝试改变你的命令到我刚刚列出的那个。

这应该只是涵盖每一个可能的边缘情况,以帮助你得到这个东西的工作!

祝你好运!