简体   繁体   中英

error: failed to push some refs to 'https://git.heroku.com/rewardsforreviews.git' help installing node modules with specific python version

I was deploying my code to Heroku with git push heroku master, but the build failed. Here is the output:

remote:        make: Leaving directory '/tmp/build_b7a0d0bbac1f35d8a343966be8695334/node_modules/ganache-cli/node_modules/keccak/build'
remote:        gyp ERR! build error
remote:        gyp ERR! stack Error: `make` failed with exit code: 2
remote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_b7a0d0bbac1f35d8a343966be8695334/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
remote:        gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
remote:        gyp ERR! System Linux 4.4.0-1062-aws
remote:        gyp ERR! command "/tmp/build_b7a0d0bbac1f35d8a343966be8695334/.heroku/node/bin/node" "/tmp/build_b7a0d0bbac1f35d8a343966be8695334/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
remote:        gyp ERR! cwd /tmp/build_b7a0d0bbac1f35d8a343966be8695334/node_modules/ganache-cli/node_modules/keccak
remote:        gyp ERR! node -v v12.16.1
remote:        gyp ERR! node-gyp -v v5.0.5
remote:        gyp ERR! not ok
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! keccak@1.4.0 rebuild: `node-gyp rebuild`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the keccak@1.4.0 rebuild script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I think the issue is related to the python version that needs to be used while installing node module ganache-cli. While testing I installed it as npm install --save ganache-cli truffle-hdwallet-provider@0.0.3 --python=python2.7

I added runtime.txt with python-2.7.17 I think the node module installation is not considering this version. Is there any other way that I need to pass a specific 2.7 python version for my Heroku app build?

I appreciate your help in resolving the issue.

I recently had this same issue, where I had specified the Python version in a Node app via the runtime.txt file, so that Heroku would use Python 2.7 to compile the node modules, because that was the only difference I could figure between my local npm install and the one happening on deployment to Heroku.

My first step was ensuring I was specifying a supported Python version .

However, I kept seeing this in the error output, despite specifying python-2.7.18 in the committed runtime.txt file:

npm ERR! gyp info find Python using Python version 3.5.2 found at "/usr/bin/python3"

I ended up finally getting Heroku to use the correct Python version, by adding a Python buildpack and inserting it before the Node buildpack :

heroku buildpacks:add --index 1 heroku/python

Then I had to commit an empty requirements.txt so that Heroku's detection script would recognize the Python buildpack as valid for the app .

After doing the above and committing the empty requirements.txt, it finally changed the aforementioned line in the output to this:

npm ERR! gyp info find Python using Python version 2.7.18 found at "/app/.heroku/python/bin/python"

So, unfortunately it didn't solve my problem, but I think it at least answers the question you asked, which I found because of having the same issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM