如何在标准环境下将私有,自托管的NPM软件包与Google App Engine节点一起使用 [英] How to use private, self hosted NPM package with Google App Engine node, standard environment

查看:91
本文介绍了如何在标准环境下将私有,自托管的NPM软件包与Google App Engine节点一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个NPM软件包托管在私有的Bitbucket git存储库中(不在官方NPM注册表中).

I have an NPM package hosted on a private Bitbucket git repo (not in the official NPM registry).

我在package.json中的依赖项"键下有此名称:

I have this in my package.json, under the "dependencies" key:

"a-private-package" git+ssh://git@bitbucket.org:myusername/a-private-package.git

当我使用SSH密钥在本地运行npm install时,它可以工作.

It works when I run npm install locally as my SSH keys are used.

但是当我使用gcloud app deploy部署到节点的App Engine标准环境时,我从Google Cloud Build获得了Host key verification failed.

But when I use gcloud app deploy to deploy to the app engine standard environment for node, I get a Host key verification failed from Google Cloud Build.

我尝试过:

向Cloud Build中添加自定义SSH密钥.

https://cloud.google.com/cloud- build/docs/access-private-github-repos

问题:GAE标准无法访问cloudbuild.yaml;无法告诉git使用SSH密钥.

Issue: No access to cloudbuild.yaml for GAE standard; cannot tell git to use the SSH key.

将我的私人git仓库添加到Google Sources.

问题:GAE标准无法访问cloudbuild.yaml;无法告诉git使用SSH密钥.

Issue: No access to cloudbuild.yaml for GAE standard; cannot tell git to use the SSH key.

npm pack; npm install

npm pack; npm install

问题:不保留回购历史记录/URL.

Issue: Does not keep repo history/URL.

真的有可能吗?

推荐答案

不幸的是,您需要在package.json中嵌入用户名/密码,但是您可能可以使用https端点:

Unfortunately you will need to embed a username/password in the package.json, but you can probably use the https endpoint:

"a-private-package": "git+https://myusername:password@bitbucket.org/myusername/a-private-package.git"

如果这对您有用,我建议您在bitbucket上创建一个单独的帐户,并将其限制为只能在该存储库上查看.

If this works for you I'd suggest creating a separate account on bitbucket and restricting it to view-only on that repo.

这篇关于如何在标准环境下将私有,自托管的NPM软件包与Google App Engine节点一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆