gpt4 book ai didi

google-cloud-datastore - gCloud:根目录中不存在文件 index.js

转载 作者:行者123 更新时间:2023-12-03 20:17:55 25 4
gpt4 key购买 nike

我是 Gcloud 的第一次用户。当我运行以下命令时:

gcloud beta functions deploy FirstBot --stage-bucket [BUCKET_NAME] --trigger-http

我在我的 cmd 中收到此错误:
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Function l
oad error: File index.js or function.js that is expected to define function does
n't exist in the root directory.

我尝试了 2 个 index.js 文件:
这是第一:
   /*
HTTP Cloud Function.

@param {Object} req Cloud Function request context.
@param {Object} res Cloud Function response context.
*/
exports.FirstBot = function FirstBot (req, res) {
response = "This is a sample response from your webhook!" //Default response from the webhook to show it's working

res.setHeader('Content-Type', 'application/json'); //Requires application/json MIME type
res.send(JSON.stringify({ "speech": response, "displayText": response
//"speech" is the spoken version of the response, "displayText" is the visual version
}));
};

这是第二个:
/
HTTP Cloud Function.

@param {Object} req Cloud Function request context.
@param {Object} res Cloud Function response context.
*/
exports.helloHttp = function helloHttp (req, res) {
response = "This is a sample response from your webhook!" //Default response from the webhook to show it's working

res.setHeader('Content-Type', 'application/json'); //Requires application/json MIME type
res.send(JSON.stringify({ "speech": response, "displayText": response
//"speech" is the spoken version of the response, "displayText" is the visual version
}));
};

我的项目名称是 FirstBot。
我也创建了一个存储桶。

我的 FirstBot 文件夹的路径是 C:\FirstBot。 index.js 文件在其中。
我正在关注教程: https://api.ai/docs/getting-started/basic-fulfillment-conversation

请帮助..将不胜感激!

最佳答案

如果您没有从 index.js 所在的同一文件夹中运行 deploy 命令,也可能会发生该错误。 IE。这只是“找不到文件”。

关于google-cloud-datastore - gCloud:根目录中不存在文件 index.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45317504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com