NPM从GCP App Engine中的Google Cloud Repository安装

时间:2017-11-27 18:07:27

标签: node.js google-app-engine npm google-cloud-platform google-cloud-source-repos

我正在尝试在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文件的帮助下在我的本地机器和云外壳中安装此依赖项,而不会出现错误,如错误消息中给出的页面所述,但似乎我无法复制此文件在我的部署中。

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

1 个答案:

答案 0 :(得分:1)

我设法使用以下配方使它起作用:

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