我的计算机运行Windows10企业版。
我找到了为聊天机器人创建Nodejs服务器的this repo。正如您所看到的,有用于启动服务器的选项。我尝试执行以下命令:node app.js DF_PROJECT_ID="agent-human-handoff-sampl-jseo" DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json"
但我得到了错误:You need to specify a path to a service account keypair in environment variable DF_SERVICE_ACCOUNT_PATH
那么到底出了什么问题呢?
发布于 2021-01-29 14:03:58
它基本上与jFriend00的解决方案相同,但我在最后添加了node app.js。您只需按照下面的顺序运行命令即可。
set DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json"
set DF_PROJECT_ID="agent-human-handoff-sampl-jseo"
node app.js顺便说一下,如果您使用linux系统或macOS,您将使用以下命令来启动服务器。
(只有一行) DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json" DF_PROJECT_ID="agent-human-handoff-sampl-jseo" node app.js
发布于 2021-01-29 13:47:51
在从命令shell运行nodejs之前,您只需在命令shell中的环境中设置这些内容:
set DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json"
set DF_PROJECT_ID="agent-human-handoff-sampl-jseo"然后,您可以运行您的程序,这些变量将位于您的节点程序继承的环境中。如果要自动执行此操作,可以创建一个小的批处理文件来设置它们,然后运行您的程序。请记住,像这样设置环境变量会将它们设置为从当前命令shell运行的程序,而不是其他命令shell,也不是以其他方式运行的程序。
设置这些设置之后,您的环境现在就配置好了,您可以像往常一样运行您的程序:
node app.jshttps://stackoverflow.com/questions/65949270
复制相似问题