【问题标题】:Error when running the new Stack Overflow Bot运行新的 Stack Overflow Bot 时出错
【发布时间】:2018-03-06 11:25:59
【问题描述】:

我在 Stack Overflow 博客上看到了新的 Stack Overflow Bot by Microsoft,并决定试一试。

在为 macOS 安装 Node V8.1.4 后,我通过在 StackBot 目录中运行 npm install 来安装机器人。没有太多问题,只是返回了一个警告。

MacBook-Air:StackBot USER$ npm install
npm WARN stackbot@1.0.0 No repository field.

up to date in 1.248s

之后,我尝试使用npm run start 运行机器人。机器人无法启动并出现此错误。

MacBook-Air:StackBot USER$ npm run start

> stackbot@1.0.0 start /Users/USER/Downloads/BotFramework-Samples-master/StackOverflow-Bot/StackBot
> node index.js

Missing one of BOTBUILDER_APP_ID, BOTBUILDER_APP_PASSWORD,     LUIS_MODEL, KB_ID, QNA_KEY, QNA_URL, BING_SEARCH_CONFIG, BING_SEARCH_KEY,     TEXT_ANALYTICS_KEY, TEXT_ANALYTICS_URL, DIALOG_ANALYZER_CLIENTID, DIALOG_ANALYZER_KEY or DIALOG_ANALYZER_URL     in environment variables!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! stackbot@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the stackbot@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/USER/.npm/_logs/2017-09-25T12_56_14_988Z-debug.log

完整的日志如下:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'start' ]
2 info using npm@5.0.3
3 info using node@v8.1.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle stackbot@1.0.0~prestart: stackbot@1.0.0
6 silly lifecycle stackbot@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle stackbot@1.0.0~start: stackbot@1.0.0
8 verbose lifecycle stackbot@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle stackbot@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/USER/Downloads/BotFramework-Samples-master/StackOverflow-Bot/StackBot/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
10 verbose lifecycle stackbot@1.0.0~start: CWD: /Users/USER/Downloads/BotFramework-Samples-master/StackOverflow-Bot/StackBot
11 silly lifecycle stackbot@1.0.0~start: Args: [ '-c', 'node index.js' ]
12 silly lifecycle stackbot@1.0.0~start: Returned: code: 1  signal: null
13 info lifecycle stackbot@1.0.0~start: Failed to exec start script
14 verbose stack Error: stackbot@1.0.0 start: `node index.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at EventEmitter.emit (events.js:213:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at ChildProcess.emit (events.js:213:7)
14 verbose stack     at maybeClose (internal/child_process.js:897:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid stackbot@1.0.0
16 verbose cwd /Users/USER/Downloads/BotFramework-Samples-master/StackOverflow-Bot/StackBot
17 verbose Darwin 16.7.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
19 verbose node v8.1.4
20 verbose npm  v5.0.3
21 error code ELIFECYCLE
22 error errno 1
23 error stackbot@1.0.0 start: `node index.js`
23 error Exit status 1
24 error Failed at the stackbot@1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

是什么导致了这个错误,有没有办法解决这个问题?

【问题讨论】:

  • 它说明了错误是什么:您没有设置所需的环境变量(“缺少一个...”)。如何配置机器人请参考this page
  • 嘿,你是如何在 stackBot 目录上运行 npm install 的?我的意思是那到底是什么?
  • ^^ 我赞同尼尔的评论。
  • 引用该页面并没有帮助解决我的问题@robertklep。它有最少的说明。前两步没有提到环境变量设置。运行开始是第 2 步。
  • @QHarr 链接到文档所有环境变量的页面部分,还链接到有关如何实际设置环境变量的页面。

标签: node.js macos npm botframework stackoverflow-bot


【解决方案1】:

你试过了吗

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-20
    • 1970-01-01
    • 2010-11-24
    • 2019-10-03
    • 2011-02-14
    相关资源
    最近更新 更多