IPFS:HTTPError:URL arg 必须是多碱基编码:不支持所选编码

编程入门 行业动态 更新时间:2024-10-03 17:07:31

IPFS:HTTPError:URL arg 必须是多<a href=https://www.elefans.com/category/jswz/34/1738151.html style=碱基编码:不支持所选编码"/>

IPFS:HTTPError:URL arg 必须是多碱基编码:不支持所选编码

我想用本地运行的 IPFS 守护进程创建一个 OrbitDB 数据库。

我的代码基于 在过去的讨论中发布的代码示例,并进行了一些更改。

这是我的代码(test.js):

import * as IpfsClient from 'ipfs-http-client'
import OrbitDB from 'orbit-db'

const ipfs = IpfsClient.create('/ip4/127.0.0.1/tcp/5001')

const orbitdb = await OrbitDB.createInstance(ipfs)

const db = await orbitdb.eventlog('mydatabase')

我通过

ipfs daemon
启动了IPFS守护进程。

当我使用

node test.js
运行我的代码时,它在最后一行失败。我收到以下错误:

/home/me/node_modules/ipfs-http-client/src/lib/core.js:100
  let error = new HTTP.HTTPError(response)
              ^

HTTPError: URL arg must be multibase encoded: selected encoding not supported
    at Object.errorHandler [as handleError] (/home/me/node_modules/ipfs-http-client/src/lib/core.js:100:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.fetch (/home/me/node_modules/ipfs-http-client/node_modules/ipfs-utils/src/http.js:145:9) {
  response: Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: {
      body: PassThrough {
        _readableState: ReadableState {
          objectMode: false,
          highWaterMark: 16384,
          buffer: BufferList { head: null, tail: null, length: 0 },
          length: 0,
          pipes: [],
          flowing: true,
          ended: true,
          endEmitted: true,
          reading: false,
          constructed: true,
          sync: false,
          needReadable: false,
          emittedReadable: false,
          readableListening: false,
          resumeScheduled: false,
          errorEmitted: false,
          emitClose: true,
          autoDestroy: true,
          destroyed: true,
          errored: null,
          closed: true,
          closeEmitted: true,
          defaultEncoding: 'utf8',
          awaitDrainWriters: null,
          multiAwaitDrain: false,
          readingMore: false,
          dataEmitted: true,
          decoder: null,
          encoding: null,
          [Symbol(kPaused)]: false
        },
        _events: [Object: null prototype] {
          prefinish: [Function: prefinish],
          error: [ [Function (anonymous)], [Function (anonymous)] ],
          data: [Function (anonymous)],
          end: [Function (anonymous)]
        },
        _eventsCount: 4,
        _maxListeners: undefined,
        _writableState: WritableState {
          objectMode: false,
          highWaterMark: 16384,
          finalCalled: true,
          needDrain: false,
          ending: true,
          ended: true,
          finished: true,
          destroyed: true,
          decodeStrings: true,
          defaultEncoding: 'utf8',
          length: 0,
          writing: false,
          corked: 0,
          sync: false,
          bufferProcessing: false,
          onwrite: [Function: bound onwrite],
          writecb: null,
          writelen: 0,
          afterWriteTickInfo: null,
          buffered: [],
          bufferedIndex: 0,
          allBuffers: true,
          allNoop: true,
          pendingcb: 0,
          constructed: true,
          prefinished: true,
          errorEmitted: false,
          emitClose: true,
          autoDestroy: true,
          errored: null,
          closed: true,
          closeEmitted: true,
          [Symbol(kOnFinished)]: []
        },
        allowHalfOpen: true,
        [Symbol(kCapture)]: false,
        [Symbol(kCallback)]: null
      },
      disturbed: true,
      error: null
    },
    [Symbol(Response internals)]: {
      url: 'http://127.0.0.1:5001/api/v0/pubsub/sub?arg=%2Forbitdb%2F.............%2Fmydatabase',
      status: 500,
      statusText: 'Internal Server Error',
      headers: Headers {
        [Symbol(map)]: [Object: null prototype] {
          'access-control-allow-headers': [ 'X-Stream-Output, X-Chunked-Output, X-Content-Length' ],
          'access-control-expose-headers': [ 'X-Stream-Output, X-Chunked-Output, X-Content-Length' ],
          'content-type': [ 'application/json' ],
          server: [ 'kubo/0.16.0' ],
          trailer: [ 'X-Stream-Error' ],
          vary: [ 'Origin' ],
          date: [ 'Thu, 01 May 2023 01:00:00 GMT' ],
          'transfer-encoding': [ 'chunked' ]
        }
      },
      counter: 0
    }
  }
}

我不确定,但在我看来 IPFS 守护进程不允许我创建数据库(或通常是文件)。这里缺少什么?我该如何解决这个问题?

回答如下:

更多推荐

IPFS:HTTPError:URL arg 必须是多碱基编码:不支持所选编码

本文发布于:2024-05-31 05:09:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1771308.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:碱基   不支持   所选   HTTPError   IPFS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!