我在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存储库的权限。但是,我不知道它是哪个用户或我需要给他什么权限。我在谷歌云页面上找不到任何答案,我没有支持包。
我希望之前我做过其他人可以帮助我。我有AA
和BB
,因为AA
中使用的代码也将用于其他项目(这是一个实用程序项目)
您可以通过使用自定义运行时并在Dockerfile中执行git用户初始化脚本来解决此问题。
"AA": "git+https://source.developers.google.com/p/AA/r/AA"
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
gcloud app deploy