Heroku: resolving npm errors during deployment - reading the / tmp file

Some new dependency or some other damn thing causes npm error during get push heroku master deployment:

 -----> Node.js app detected -----> Resolving engine versions Using Node.js version: 0.10.1 Using npm version: 1.2.15 -----> Fetching Node.js binaries -----> Vendoring node into slug -----> Installing dependencies with npm .... npm ERR! Additional logging details can be found in: npm ERR! /tmp/build_24pmtv04ok0ss/npm-debug.log npm ERR! not ok code 0 

not ok really. There is no other useful information on the console, so of course I want to see what is in this log file.

So I try a little:

 $ heroku run cat /tmp/build_24pmtv04ok0ss/npm-debug.log 

However, such a file does not exist:

 Running `cat /tmp/build_24pmtv04ok0ss/npm-debug.log` attached to terminal... up, run.3166 cat: /tmp/build_24pmtv04ok0ss/npm-debug.log: No such file or directory 

My questions are as follows:

  • Where did the log file go? Why can't I read it?
  • Is there any other way for Heroku / npm to give me a detailed error printed on the console?
  • Why is the same node environment working fine locally but not working on Heroku?
+6
source share
2 answers

When you click on the code on Heroku, your assembly runs on the temporary dynamics of the assembly, so when the assembly is complete, all files will disappear, because dynos has ephemeral file systems . The reason why heroku run cat /tmp/build_24pmtv04ok0ss/npm-debug.log didn’t help is because you attached a one-time recorder with the new file system of your existing application (completely separate from the built-in dyno).

All hope is not lost. You should be able to see what happens from configuring buildpack to cat out npm-debug.log when exiting as follows:

 function cat_npm_debug_log() { if [ -f $BUILD_DIR/npm-debug.log ]; then cat $BUILD_DIR/npm-debug.log fi } trap cat_npm_debug_log EXIT 

I did not test it completely, but I quickly created the default fork Node buildpack before doing what I just showed above . Feel free to try installing it as a custom buildpack :

 heroku config:add BUILDPACK_URL="https://github.com/ryanbrainard/heroku-buildpack-nodejs.git" 
+6
source

Before you run into the problem of using a custom build package, try enabling more verbose log output to the hero using:

heroku config:set NPM_CONFIG_LOGLEVEL=verbose

See https://devcenter.heroku.com/articles/troubleshooting-node-deploys for more details.

+6
source

All Articles