![](/img/trans.png)
[英]! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/stark-dawn-54447.git'
[英]error: failed to push some refs to 'https://git.heroku.com/rewardsforreviews.git' help installing node modules with specific python version
我正在使用 git push heroku master 将我的代码部署到 Heroku,但构建失败。 这是输出:
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.
我认为这个问题与安装节点模块ganache-cli时需要使用的python版本有关。 在测试时,我将它安装为 npm install --save ganache-cli truffle-hdwallet-provider@0.0.3 --python=python2.7
我用python-2.7.17添加了runtime.txt我认为节点模块安装没有考虑这个版本。 还有其他方法需要为我的 Heroku 应用程序构建传递特定的 2.7 python 版本吗?
感谢您帮助解决问题。
我最近遇到了同样的问题,我通过 runtime.txt 文件在 Node 应用程序中指定了 Python 版本,因此 Heroku 将使用 Python 2.7 来编译节点模块,因为这是我能在本地npm install
和部署到 Heroku 时发生的那个。
我的第一步是确保我指定了受支持的 Python 版本。
但是,尽管在提交的 runtime.txt 文件中指定了python-2.7.18
,我还是在错误输出中看到了这一点:
npm ERR! gyp info find Python using Python version 3.5.2 found at "/usr/bin/python3"
通过添加 Python buildpack 并将其插入 Node buildpack 之前,我最终让 Heroku 使用了正确的 Python 版本:
heroku buildpacks:add --index 1 heroku/python
然后我必须提交一个空的 requirements.txt 以便Heroku 的检测脚本将Python buildpack识别为对应用程序有效。
在执行上述操作并提交空的 requirements.txt 后,它最终将输出中的上述行更改为:
npm ERR! gyp info find Python using Python version 2.7.18 found at "/app/.heroku/python/bin/python"
所以,不幸的是它没有解决我的问题,但我认为它至少回答了你提出的问题,我发现这是因为有同样的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.