UnhandledPromiseRejectionWarning: InvalidRepoVersionError: Incompatible repo versions. (IPFS-JS 0.55.3)-(NODE JS 14.17.0)

UnhandledPromiseRejectionWarning: InvalidRepoVersionError: Incompatible repo versions. (IPFS-JS 0.55.3)-(NODE JS 14.17.0)

刚学ipfs js,安装的版本是version 0.55.3 (https://www.npmjs.com/package/ipfs),另外我也在用node js with版本 14.17.0 (LTS) 和 MacOS BigSur 11.4

当我按照 link https://github.com/ipfs/js-ipfs/tree/master/examples/ipfs-101 上的教程进行操作时,我总是遇到这样的错误:

(node:9857) UnhandledPromiseRejectionWarning: InvalidRepoVersionError: Incompatible repo versions. Automatic migrations disabled. Please migrate the repo manually.
    at IpfsRepo.open (/Users/username/Documents/program/ipfs-node-10/node_modules/ipfs-repo/src/index.js:142:17)
    at async loadRepo (/Users/username/Documents/program/ipfs-node-10/node_modules/ipfs-core/src/components/storage.js:74:5)
    at async Function.start (/Users/username/Documents/program/ipfs-node-10/node_modules/ipfs-core/src/components/storage.js:54:41)
    at async Object.create (/Users/username/Documents/program/ipfs-node-10/node_modules/ipfs-core/src/components/index.js:223:21)
    at async main (/Users/username/Documents/program/ipfs-node-10/index.js:4:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9857) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9857) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

这是我的 index.js:

的代码
const IPFS = require('ipfs')

async function main () {
  const node = await IPFS.create()
  const version = await node.version()

  console.log('Version:', version.version)
  // ...
}

main()

这是我的 package.json:

{
  "name": "ipfs-node-10",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ipfs": "^0.55.3"
  }

你能帮我找到解决这个问题的方法吗?

您的默认 IPFS 存储库似乎是旧版本,出​​于某种原因不想迁移它。我会做的是:

  1. 只需使用不同的 repo await IPFS.create({repo: "example"})

  2. 删除您当前的存储库(如果默认,可能在 ~/.jsipfs 中)