1

我有一个 nodejs 应用程序。我正在尝试将其推送到 heroku 并在 heroku 中执行它。通过 heroku CLI 部署时,我遇到了一个问题。请帮忙。谢谢。我知道这可以在本地系统的帮助下git config --global url."https://".insteadOf ssh://解决,但是在部署到 Heroku 时如何解决?

remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.16.2...
remote:        Using default npm version: 6.14.4
remote:
remote: -----> Installing dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        npm ERR! Error while executing:
remote:        npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/xxxx/xxx.git
remote:        npm ERR!
remote:        npm ERR! Host key verification failed.
remote:        npm ERR! fatal: Could not read from remote repository.
remote:        npm ERR!
remote:        npm ERR! Please make sure you have the correct access rights
remote:        npm ERR! and the repository exists.
remote:        npm ERR!
remote:        npm ERR! exited with error code: 128
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.FA1w0/_logs/2020-04-14T06_41_51_429Z-debug.log
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        Some possible problems:
remote:
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote:        Love,
remote:        Heroku
remote:
4

2 回答 2

1

刚刚遇到了同样的问题。仍然不知道如何正确修复它。但是快速修复是手动替换ssh://git@github.com/xxxx/xxx.git为文件https://github.com/xxxx/xxx.git中。package-lock.json

于 2021-01-31T15:19:00.530 回答
0

基于NPM 存储库中的此评论,另一种解决方法是配置 Git,以便强制使用 https 而不是 SSH:

git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
于 2021-08-23T17:45:30.587 回答