我正在部署已在与我的prod环境相同的暂存环境中测试过的代码。代码在暂存中正确部署,但此后无法在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服务器上安装它)我很好奇是否有人知道我应该做什么。
答案 0 :(得分:1)
您的日志消息表明您的Heroku dyno正在尝试运行命令./node_modules/.bin/_mocha
。此文件不存在,因此如果无法启动,则使用Heroku进程。
Mocha是JS的测试框架,因此我不确定为什么会在生产中运行。
我会检查一些事情:
Procfile
中,您是否意外地告诉Heroku运行摩卡?package.json
文件中?./node_modules/mocha/bin/mocha
来执行此操作。如果你完成这一步但仍然没有工作,请尝试将命令更改为我刚才列出的命令。这应该只是涵盖每一个可能的边缘情况,以帮助你让这个东西工作!
祝你好运!