Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Google Cloud AppEngine-NPM依赖项-身份验证凭据无效_Node.js_Google App Engine_Npm_Google Cloud Platform_Dependencies - Fatal编程技术网

Node.js Google Cloud AppEngine-NPM依赖项-身份验证凭据无效

Node.js Google Cloud AppEngine-NPM依赖项-身份验证凭据无效,node.js,google-app-engine,npm,google-cloud-platform,dependencies,Node.js,Google App Engine,Npm,Google Cloud Platform,Dependencies,我在GC(谷歌云)存储库中创建了一个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.

我在GC(谷歌云)存储库中创建了一个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
我获得了无效的身份验证凭据。错误:

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用户初始化脚本来解决此问题

  • 将依赖项添加到package.json,方法与您在问题中所做的相同

    "AA": "git+https://source.developers.google.com/p/AA/r/AA"
    
  • 通过转到并遵循验证步骤获取初始化脚本

  • 将其存储在项目根目录中的文件中。 将app.yaml中的运行时更改为“自定义”。添加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
    
  • 运行
    gcloud应用程序部署


  • 希望您已经运行了
    gcloud init
    来完成身份验证,并遵循了步骤。您是否能够通过身份验证来克隆源代码?例如,
    gcloud source repos clone REPOSITORY\u NAME
    @YogenderSingh我有
    gcloud init
    ,我也可以在本地安装依赖项,因此我有身份验证locally@ChristopherP是的,我已经克隆了repo locallyok,我会尝试一下,但这似乎是一个非常多的解决办法。。。这就是Google团队的想法吗?在任何情况下,如果运行时缺少应用程序或构建所必需的内容(本例中为凭据),那么解决方案将是在自定义运行时实现它。抱歉,这不起作用。我花了一整天的时间在这上面,没有任何进展。无论我如何创建、复制或只是发送auth.bash文件,它仍然会返回错误消息。最重要的是,当我尝试回显我正在创建的文件内容时(例如,当使用
    touch
    命令时)会出现错误,听起来您在dockerfile中遇到了一些问题。您能确切地告诉我您遇到了什么类型的错误吗?问题是在复制粘贴中,您在一行末尾添加了回车符(
    \r
    ),这会导致auth.sh失败(不知道为什么)。一旦移除,它就会工作。我不知道怎么做,但你应该在答案中加上这个,这样其他人就会知道了。此外,您还可以补充说,这是google can团队的官方解决方案,正如他们所建议的那样