0

I just learned about ipfs js, and the version I have installed is version 0.55.3 (https://www.npmjs.com/package/ipfs), besides I'm also using node js with version 14.17.0 (LTS) and MacOS BigSur 11.4

When I follow the tutorial on the link https://github.com/ipfs/js-ipfs/tree/master/examples/ipfs-101 I always get an error like this:

(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.

And here is the code from my 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()

And this is my 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"
  }

Can you help me to find a solution to this problem?

1 Answer 1

0

It appears like your default IPFS repo is an older version, and it doesn't want to migrate it for some reason. What I'd do is either:

  1. Just use a different repo await IPFS.create({repo: "example"})

  2. Delete your current repo (if default, perhaps it's in ~/.jsipfs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.