gpt4 book ai didi

node.js - NPM 从 GCP App Engine 中的 Google Cloud Repository 安装

转载 作者:搜寻专家 更新时间:2023-10-31 23:23:25 26 4
gpt4 key购买 nike

我正在尝试在 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)。如错误消息中给出的页面所述,借助 .netrc 文件,我可以在本地计算机和云 shell 中无错误地安装此依赖项,但似乎无法复制此文件在我的部署中。

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

最佳答案

我设法使用以下方法让它工作:

  1. 源 url 必须以 git+https:// 开头,而不仅仅是 https:// (感谢 Lugassy ),不要使用用户名或密码
  2. Google's Git configurator 获取一段谷歌魔法
  3. 在终端中运行来自 Google 的命令

关于node.js - NPM 从 GCP App Engine 中的 Google Cloud Repository 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47517213/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com