Q:

next/node app deployment errors with heroku

I am trying to deploy the following web app with heroku:
https://github.com/darego1990/web1
although I get the following build log error and I am not sure why:
-----> Node.js app detected

-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_ENV=production
   NODE_MODULES_CACHE=true
   NODE_VERBOSE=false

-----> Installing binaries
   engines.node (package.json):  0.12.x
   engines.npm (package.json):   2.5.x

   Resolving node version 0.12.x...
   Downloading and installing node 0.12.18...
   Bootstrapping npm 2.5.x (replacing 2.15.11)...
   npm 2.5.x installed

-----> Building dependencies
   Installing node modules (package.json + package-lock)
   react@16.6.3 node_modules/react
   ├── object-assign@4.1.1
   ├── prop-types@15.6.2
   ├── scheduler@0.11.3
   └── loose-envify@1.4.0 (js-tokens@4.0.0)

   react-dom@16.6.3 node_modules/react-dom
   ├── object-assign@4.1.1
   ├── loose-envify@1.4.0 (js-tokens@4.0.0)
   ├── prop-types@15.6.2
   └── scheduler@0.11.3

   next@7.0.2 node_modules/next
   ├── babel-core@7.0.0-bridge.0
   ├── htmlescape@1.1.1
   ├── fresh@0.5.2
   ├── etag@1.8.1
   ├── case-sensitive-paths-webpack-plugin@2.1.2
   ├── http-status@1.0.1
   ├── hoist-non-react-statics@2.5.5
   ├── ansi-html@0.0.7
   ├── path-to-regexp@2.1.0
   ├── nanoid@1.2.1
   ├── unfetch@3.0.0
   ├── babel-plugin-transform-react-remove-prop-types@0.4.15
   ├── strip-ansi@3.0.1 (ansi-regex@2.1.1)
   ├── babel-plugin-react-require@3.0.0
   ├── minimist@1.2.0
 .....
   Running heroku-postbuild

   > my-app@1.0.0 heroku-postbuild 
/tmp/build_f85d5b0987590f76e56a2945b6c4ccc1
   > npm run build

   > my-app@1.0.0 build /tmp/build_f85d5b0987590f76e56a2945b6c4ccc1
   > next build

 /tmp/build_f85d5b0987590f76e56a2945b6c4ccc1/node_modules/next/dist/bin
/next:44
   var inspectArg = process.argv.find(function (arg) {
                          ^
TypeError: undefined is not a function
at Object.<anonymous> 

(/tmp/build_f85d5b0987590f76e56a2945b6c4ccc1/node_modules/next/dist
/bin/next:44:31)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

npm ERR! Linux 4.4.0-1031-aws
npm ERR! argv "node" "/tmp/build_f85d5b0987590f76e56a2945b6c4ccc1/.heroku/node/bin/npm" "run" "build"
npm ERR! node v0.12.18
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! my-app@1.0.0 build: next build
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@1.0.0 build script 'next build'.
npm ERR! This is most likely a problem with the my-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     next build
npm ERR! You can get their info via:
npm ERR!     npm owner ls my-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/build_f85d5b0987590f76e56a2945b6c4ccc1/npm-debug.log
npm ERR! Linux 4.4.0-1031-aws
npm ERR! argv "node" "/tmp/build_f85d5b0987590f76e56a2945b6c4ccc1/.heroku/node/bin/npm" "run" "heroku-postbuild" "--if-present"
npm ERR! node v0.12.18
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! my-app@1.0.0 heroku-postbuild: npm run build
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@1.0.0 heroku-postbuild script 'npm run build'.
npm ERR! This is most likely a problem with the my-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build
npm ERR! You can get their info via:
npm ERR!     npm owner ls my-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/build_f85d5b0987590f76e56a2945b6c4ccc1/npm-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

   If you're stuck, please submit a ticket so we can help:
   https://help.heroku.com/

   Love,
   Heroku

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

A:

Can you update your package.json file with below:
"engines": {
   "node": ">= 8.0.0"
}

It looks like your node engine is quite old and in next.js' github repo, looks like they are using >8.0.0.

