4

我正在尝试在 Google Cloud 的 App Engine 中部署 node.js 程序,但出现以下错误:

Step #1: npm ERR! Error while executing:
Step #1: npm ERR! /usr/bin/git ls-remote -h -t https://source.developers.google.com/p/(project)/r/(repository)
Step #1: npm ERR! 
Step #1: npm ERR! fatal: remote error: 
Step #1: npm ERR! 
Step #1: npm ERR! 
Step #1: npm ERR! Invalid authentication credentials.
Step #1: npm ERR! 
Step #1: npm ERR! Please generate a new identifier:
Step #1: npm ERR!   https://source.developers.google.com/auth/start?scopes=https://www.googleapis.com/auth/cloud-platform
Step #1: npm ERR! 
Step #1: npm ERR! 
Step #1: npm ERR! 
Step #1: npm ERR! exited with error code: 128

这是因为我的项目中的依赖项位于https://source.developers.google.com/p/(project)/r/(repository). 如错误消息中给出的页面所述,我可以在我的本地计算机和云 shell 中借助 .netrc 文件安装此依赖项而不会出现错误,但似乎我无法复制此文件在我的部署中。

有没有办法指定应该使用哪些凭据?请注意,我无法使用npm 文档user:pass@host中解释的格式,因为 Google 给我的用户名和密码包含 @s 和 \s。

4

1 回答 1

1

我设法使用以下配方使其工作:

  1. 源 URL 必须以 开头git+https://,而不仅仅是https://(感谢Lugassy),不要使用用户名或密码
  2. 从Google 的 Git 配置器中获取一块 google 魔法
  3. 在终端中运行来自 Google 的命令
于 2018-09-13T05:24:29.563 回答