Heroku上的第二个节点应用程序部署总是失败

时间:2018-01-06 05:09:27

标签: node.js git heroku deployment

我在部署时遇到了Heroku的一个奇怪问题。

我的第二次部署(在提交新的github更改并将它们推送到我的应用程序之后)似乎总是崩溃并出现相同的错误消息,但是,如果我创建一个新的Heroku应用程序并在那里部署它,它将始终成功部署。 / p>

这是构建失败时收到的错误。

-----> Node.js app detected
-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NPM_CONFIG_PRODUCTION=true
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 8.x...
       Downloading and installing node 8.9.4...
       Using default npm version: 5.6.0
-----> Restoring cache
       Loading 2 from cacheDirectories (default):
       - node_modules
       - bower_components (not cached - skipping)
-----> Building dependencies
       Installing node modules (package.json + package-lock)
       npm ERR! path /tmp/build_ab6facc2006ab24a04683a1ab7266974/bothello-Bothello-Faq-v2-Demo-e5f231b/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/mkdirp/node_modules/minimist
       npm ERR! code ENOENT
       npm ERR! errno -2
       npm ERR! syscall rename
       npm ERR! enoent ENOENT: no such file or directory, rename '/tmp/build_ab6facc2006ab24a04683a1ab7266974/bothello-Bothello-Faq-v2-Demo-e5f231b/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/mkdirp/node_modules/minimist' -> '/tmp/build_ab6facc2006ab24a04683a1ab7266974/bothello-Bothello-Faq-v2-Demo-e5f231b/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/mkdirp/node_modules/.minimist.DELETE'
       npm ERR! enoent This is related to npm not being able to find a file.
       npm ERR! enoent

       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2018-01-06T05_06_42_422Z-debug.log
-----> Build failed

       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       Some possible problems:

       - Node version not specified in package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       Love,
       Heroku

 !     Push rejected, failed to compile Node.js app.
 !     Push failed 

我有点被困在这里做什么。任何帮助都会很棒。

干杯, Ĵ

1 个答案:

答案 0 :(得分:2)

对于任何感兴趣的人,我通过Heroku CLI禁用节点模块缓存来修复此问题:

heroku config:set NODE_MODULES_CACHE=false --app app_name

这解决了构建问题。