简体   繁体   中英

curl: (7) Failed to connect to localhost port 3000: Connection refused

I typed this into terminal

$ curl -X POST http://localhost:3000/voice

and I got this error

curl: (7) Failed to connect to localhost port 3000: Connection refused

I've looked everywhere for a solution I can understand, but found no luck. Any help is appreciated.

I think it's because you have not started your local host with port 3000.

Try http://localhost:3000/ in your browser. See if it's connected.

If not, you need to start your local host first with port 3000.

I think port 3000 is not open on the host. To see if something is listening on a certain port or open at all, you can use netstat -tlpen | grep 8080 netstat -tlpen | grep 8080 or nc -vz [host] [port] .

需要使用端口 3000 启动本地主机: 1-运行服务器,例如使用节点服务器: $ node nameOfCode.js 2-然后在新的终端类型curl -X POST http://localhost:3000/voice我做到了,它对我有用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM