使用 Github 包作为 npm 节点模块时的 Firebase 云功能部署问题

Jer*_*yal 2 node.js npm firebase google-cloud-platform google-cloud-functions

我在我的 Firebae 云函数项目中使用 github repo 标签作为 npm 模块,并且它在本地环境中运行良好。

//package.json
"@instantish/martian": "github:Rakmo33/martian#v2.3.0",
Run Code Online (Sandbox Code Playgroud)

但是,当我部署到 Firebase 云功能时,它会引发以下错误:

"Build failed: npm ERR! Error while executing:\nnpm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/Rakmo33/martian.git\nnpm ERR! \nnpm ERR! 
Host key verification failed.\nnpm ERR! fatal: Could not read from remote repository.\nnpm ERR! \nnpm ERR! 
Please make sure you have the correct access rights\nnpm ERR! and the repository exists.\nnpm ERR! \nnpm ERR! exited with error code: 128\n\nnpm ERR! 
A complete log of this run can be found in:\nnpm ERR! /www-data-home/.npm/_logs/2021-11-25T10_28_13_554Z-debug.log; Error ID: beaf8772"
Run Code Online (Sandbox Code Playgroud)

DVN*_*kin 5

不知道您的项目的详细信息,但事实是您是否执行了:

npm install git+https://git@github.com/Rakmo33/martian.git#v2.3.0
Run Code Online (Sandbox Code Playgroud)

你的里面会有这样的东西package.json

"dependencies": {
    "@rakmo33/martian_fork": "git+https://git@github.com/Rakmo33/martian.git#v2.3.0"
  }
Run Code Online (Sandbox Code Playgroud)

并且您可以避免使用任何受密码保护的 SSH 密钥。