我正在尝试测试我用GroupMe制作的一个Node.js机器人。我用的是GroupMe的GroupMe。在运行foreman start和curl -X POST -d \cool guy\ localhost:5000 (来自类似的问题)之后,我得到了错误curl: (1) Protocol "guy http" not supported or disabled in libcurl。我尝试用双引号包装消息,但这只会导致语法错误。我怎么才能解决这个问题?
编辑:
我试过了
$ curl -X POST -d "cool guy" localhost:5000 并从工头那里得到了以下错误:
22:04:16 web.1 | started with pid 5788
22:04:32 web.1 | undefined:1
22:04:32 web.1 | cool guy
22:04:32 web.1 | ^
22:04:32 web.1 | SyntaxError: Unexpected token c
22:04:32 web.1 | at Object.parse (native)
22:04:32 web.1 | at Object.respond (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\bot.js:11:24)
22:04:32 web.1 | at apply (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\router.js:448:19)
22:04:32 web.1 | at _every (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\router.js:30:9)
22:04:32 web.1 | at Router.invoke (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\router.js:454:5)
22:04:32 web.1 | at IncomingMessage.parseAndInvoke (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\http\index.js:175:10)
22:04:32 web.1 | at IncomingMessage.g (events.js:199:16)
22:04:32 web.1 | at IncomingMessage.emit (events.js:104:17)
22:04:32 web.1 | at _stream_readable.js:908:16
22:04:32 web.1 | at process._tickCallback (node.js:355:11)
22:04:32 web.1 | exited with code 1
22:04:32 system | sending SIGKILL to all processes发布于 2021-01-24 22:26:47
在localhost前面添加http://。curl使用的库Libcurl支持许多不同的协议。Curl是正确的假设http,但似乎有一个错误。
编辑:在再次阅读问题后,我看到curl是在没有http支持的情况下编译的。如果您自己编译了它,请确保启用http支持。如果使用发行版包管理器安装它,请尝试重新安装。
https://stackoverflow.com/questions/37956363
复制相似问题