Node app fails build on Heroku due to gyp - Python version

Viewed 11

I have a Node.js application, perfectly working on Heroku. I need a clone of it, with few changes in the code. So I cloned the directory, and connected it to a new app in Heroku. This time, I can't manage to push it. It's working locally, but when I push the commit I get:

remote: -----> Installing dependencies        
remote:        Installing node modules (package.json)        
remote:                
remote:        > node-expat@2.4.0 install /tmp/build_06fbca85/node_modules/node-expat        
remote:        > node-gyp rebuild        
remote:                
remote:        gyp ERR! find Python         
remote:        gyp ERR! find Python Python is not set from command line or npm configuration        
remote:        gyp ERR! find Python Python is not set from environment variable PYTHON        
remote:        gyp ERR! find Python checking if "python" can be used        
remote:        gyp ERR! find Python - executable path is "/usr/bin/python"        
remote:        gyp ERR! find Python - version is "3.10.4"        
remote:        gyp ERR! find Python - version is 3.10.4 - should be >=2.6.0 <3.0.0        
remote:        gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED        
remote:        gyp ERR! find Python checking if "python2" can be used        
remote:        gyp ERR! find Python - "python2" is not in PATH or produced an error        
remote:        gyp ERR! find Python         
remote:        gyp ERR! find Python **********************************************************  

my package.json has

  "engines": {
    "node": "10.17.0",
    "npm": "6.11.3"
  },

I'v already tried to add the Python Buildpack, and specify in runtime.txt

python-2.7.14

It didn't work. What should I do? Same code works in the other old heroku app.

0 Answers
Related