I am currently experiencing the exact same thing trying to push my node.js app to Heroku. I have seemingly changed nothing personally that would have caused this.
I’ll reply here if I happen to find a resolution. I would very much appreciate if anyone else could do the same
-----> Building on the Heroku-22 stack
-----> Using buildpacks:
1. heroku/nodejs
2. https://github.com/jontewks/puppeteer-heroku-buildpack.git
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=14.15.0
engines.npm (package.json): unspecified (use default)
Resolving node version >=14.15.0...
Downloading and installing node 20.7.0...
Detected package-lock.json: defaulting npm to version 5.x.x
Bootstrapping npm 5.x.x (replacing 10.1.0)...
npm 5.10.0 installed
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules (package.json + package-lock)
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.zV13I/_logs/2023-09-21T14_43_04_658Z-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:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
What resolved it for me was to go to my package.json and package-lock.json and change the versions under engines. I also updated my local node.js version to the current version.
In my package.json and package-lock.json, engines was: