1

I forked node-js-sample and made just added index.htm with some content When I click the button "Doploy to heroku" app fails to build with following error:

-----> 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):  4.0.0
   engines.npm (package.json):   unspecified (use default)

   Resolving node version 4.0.0...
   Downloading and installing node 4.0.0...
   Detected package-lock.json: defaulting npm to version 5.x.x
   Bootstrapping npm 5.x.x (replacing 2.14.2)...
   npm 5.x.x installed
ERROR: npm is known not to run on Node.js v4.0.0
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at 
https://nodejs.org/
ERROR: npm is known not to run on Node.js v4.0.0
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at 
https://nodejs.org/
ERROR: npm is known not to run on Node.js v4.0.0
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at 
https://nodejs.org/
-----> Change to Node.js build process 
   Heroku has begun executing the "build" script defined in package.json
   during Node.js builds.
   Read more: https://devcenter.heroku.com/changelog-items/1573
-----> 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

From what I understand heroku try to runs my code with incorrect version of node.js, but why?

2 Answers 2

1

The repository hasn't been updated in 4 or more years and still depend on node.js 4 and lists the same on the package.json. It is a compatibility issue, before deploying change it to 6.0.0 and try, you might have luck.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank You a lot. That was the problem. Funny thing is that it worked several days ago on heroku, just fine. They must have update environments since then
0

Ran into the same issue recently which was a real pain, found a solution here https://devcenter.heroku.com/articles/nodejs-support

Currently, supported versions are 10.x, 12.x, 13.x, and 14.x.

You should always specify a Node.js version that matches the runtime you’re developing and testing with.

Updated node globally and specified the engine in package.json like:

"engines": {
"node": "10.20.x"

},

Hope this helps someone

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.