繁体   English   中英

使用 ipfsd-ctl 生成 IPFS 守护程序时出现“POST http://localhost:9090/spawn ERR_CONNECTION_REFUSED”错误

[英]“POST http://localhost:9090/spawn ERR_CONNECTION_REFUSED” error while spawning an IPFS daemon using ipfsd-ctl

我正在尝试使用提供的远程端点使用 ipfsd-ctl 库从浏览器生成 IPFS 守护程序。

这是我指的链接

 // Start a remote disposable node, and get access to the api // print the node id, and stop the temporary daemon const Ctl = require('ipfsd-ctl') const port = 9090 const server = Ctl.createServer(port, { ipfsModule: require('ipfs'), ipfsHttpModule: require('ipfs-http-client') }, { js: { ipfsBin: 'path/js/ipfs/bin' }, go: { ipfsBin: 'path/go/ipfs/bin' }, }) const factory = Ctl.createFactory({ ipfsHttpModule: require('ipfs-http-client'), remote: true, endpoint: `http://localhost:${port}` // or you can set process.env.IPFSD_CTL_SERVER to http://localhost:9090 }) await server.start() const ipfsd = await factory.spawn() const id = await ipfsd.api.id() console.log(id) await ipfsd.stop() await server.stop()

它显示“服务器未在浏览器中实现”警告和“POST http://localhost:9090/spawn net::ERR_CONNECTION_REFUSED”错误

Ctl.createServer 启动 Ctl.createFactory 将连接到的 HTTP 服务器。 正如警告所说“服务器未在浏览器中实现”,您需要在nodejs中运行它,并从浏览器使用 Ctl.createFactory 与之交互。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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