Google Cloud AppEngine - NPM依赖关系 - 无效的身份验证凭据

问题描述 投票:0回答:1

我在GC(Google云)存储库中创建了一个Node.js项目(我们称之为AA),然后创建了另一个项目(BB)并使用AA作为依赖项:

"dependencies": {
  "@slack/client": "^4.9.0",
  "axios": "^0.18.0",
  "big-integer": "^1.6.41",
  "https-proxy-agent": "^2.2.1",
  "moment": "^2.24.0",
  "mongoose-auto-increment": "^5.0.1",
  "mssql": "^4.3.0",
  "xml2js": "^0.4.19",
  "AA": "git+https://source.developers.google.com/p/AA/r/AA",
}

现在,当我尝试将其部署到AppEngine时:

gcloud -q app deploy server/app-prod.yaml --project BB

我得到Invalid authentication credentials.错误:

Step #1: npm ERR! Error while executing:
Step #1: npm ERR! /usr/bin/git ls-remote -h -t https://source.developers.google.com/p/AA/r/AA
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/new-password
Step #1: npm ERR!
Step #1: npm ERR!
Step #1: npm ERR!
Step #1: npm ERR! exited with error code: 128
Step #1:
Step #1: npm ERR! A complete log of this run can be found in:
Step #1: npm ERR!     /root/.npm/_logs/2019-03-31T12_25_41_034Z-debug.log
Step #1: error building image: error building stage: waiting for process to exit: exit status 1

似乎在AppEngine上运行构建的服务没有AA存储库的权限。但是,我不知道它是哪个用户或我需要给他什么权限。我在谷歌云页面上找不到任何答案,我没有支持包。

我希望之前我做过其他人可以帮助我。我有AABB,因为AA中使用的代码也将用于其他项目(这是一个实用程序项目)

node.js google-app-engine npm google-cloud-platform dependencies
1个回答
1
投票

您可以通过使用自定义运行时并在Dockerfile中执行git用户初始化脚本来解决此问题。

  1. 像在问题中一样,将依赖项添加到package.json中 "AA": "git+https://source.developers.google.com/p/AA/r/AA"
  2. 通过访问this URL并按照身份验证步骤获取初始化脚本。
  3. 将其存储在项目根目录中的文件中。将app.yaml中的运行时更改为“custom”。添加如下所示的Dockerfile: FROM gcr.io/google_appengine/nodejs RUN /usr/local/bin/install_node '>=8.0.0' COPY . /app/ #Change to filename of the script stored in step 1 RUN /bin/bash /app/auth.bash RUN npm install --unsafe-perm || \ ((if [ -f npm-debug.log ]; then \ cat npm-debug.log; \ fi) && false) CMD npm start
  4. 运行gcloud app deploy
© www.soinside.com 2019 - 2024. All rights reserved.