js-ipfs version: 0.28.2-
Repo version: 6
System version: x64/linux
Node.js version: v9.11.1
Linux common 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
const IPFSFactory = require('ipfsd-ctl');
IPFSFactory
.create({ type: 'proc', exec: IPFS })
.spawn({ disposable: false }, async (err, ipfsd) => {
ipfsd.init({}); // <-- Throw error
})
I'm getting invalid block error on init ipfs:
Error: invalid block
at setImmediate (/home/jonybang/ipfs-service/node_modules/ipfsd-ctl/node_modules/ipfs-repo/src/blockstore.js:90:20)
at Immediate.<anonymous> (/home/jonybang/ipfs-service/node_modules/async/internal/setImmediate.js:27:16)
at runCallback (timers.js:763:18)
at tryOnImmediate (timers.js:734:5)
at processImmediate (timers.js:716:5)
Emitted 'error' event at:
at done (/home/jonybang/ipfs-service/node_modules/ipfs/src/core/components/init.js:21:14)
at /home/jonybang/ipfs-service/node_modules/async/internal/once.js:12:16
at next (/home/jonybang/ipfs-service/node_modules/async/waterfall.js:21:29)
at /home/jonybang/ipfs-service/node_modules/async/internal/onlyOnce.js:12:16
at parallel (/home/jonybang/ipfs-service/node_modules/ipfs/src/core/components/init.js:99:13)
at /home/jonybang/ipfs-service/node_modules/async/internal/parallel.js:39:9
at /home/jonybang/ipfs-service/node_modules/async/internal/once.js:12:16
at iteratorCallback (/home/jonybang/ipfs-service/node_modules/async/eachOf.js:58:13)
at /home/jonybang/ipfs-service/node_modules/async/internal/onlyOnce.js:12:16
at /home/jonybang/ipfs-service/node_modules/async/internal/parallel.js:36:13
I'm just running code, and i'm don't know why it crashes on my server.
@dryajov mind checking what's up here?
This looks to be the constructor check issue. Probably running v0.15.0 of js-ipld which uses ~0.6.1 of js-ipfs-block.
https://github.com/ipfs/js-ipfs-block/blob/v0.6.1/src/index.js#L61,L63
Where as v0.19.0 js-ipfs-repo which uses ~0.7.1 of js-ipfs-block.
I don't know exactly which dependency is locking things down, but v0.28.2 of js-ipfs does ship with ~0.24.4 of js-ipfs-unixfs-engine, which might be holding things back.
find . -type d -name 'ipfs-block' | tee -a /dev/stderr | xargs -I "{}" cat "{}"/package.json | jq '.version'
./node_modules/ipfs-repo/node_modules/ipfs-block
./node_modules/ipfs-api/node_modules/ipfs-block
./node_modules/ipfs-block
"0.7.1"
"0.7.1"
"0.6.1"
See https://github.com/ipfs/js-ipfsd-ctl/issues/223#issuecomment-385803451
js-ipfsd-ctl uses a different version of js-ipfs-repo which is resulting in this compatibility issue.
@vasco-santos once you update deps on ipfsd-ctl and release a new version, can you update here so that @Jonybang can test it? Thanks!
ok, i will test this today
@diasdavid I can't test this issue because of ipfs installation via npm failed:
npm i --save ipfsd-ctl # done
npm i --save ipfs # error
Output:
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/package.json'
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/LICENSE'
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/index.js'
WARN tar ENOENT: no such file or directory, open '/Users/jonybang/workspace/orbit-test/test-ipfs/node_modules/.staging/minimist-7b3bbede/.travis.yml'
npm ERR! code EINTEGRITY
npm ERR! sha512-57RAHqbMMcVLEkbzx6PlMs7LnwsfMJrzjjNCNAsQuN2wcT8Abm09UIjo2P36x0leYMNIG2SWiyr1H5OLSKn74Q== integrity checksum failed when using sha512: wanted sha512-57RAHqbMMcVLEkbzx6PlMs7LnwsfMJrzjjNCNAsQuN2wcT8Abm09UIjo2P36x0leYMNIG2SWiyr1H5OLSKn74Q== but got sha512-YtyTkU17VoRDdvtad8VO6d4PMVoKPt2LKdXp49y/ogWEk5R1hYvIaWGWfxf46qZTRoyC0RVjujprSfKVzjfXXA==. (27347 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jonybang/.npm/_logs/2018-06-01T14_32_48_476Z-debug.log
/Users/jonybang/.npm/_logs/2018-06-01T14_32_48_476Z-debug.log:
https://pastebin.com/SUcDnTed
Node version: v10.2.1
OS: MacOS Sierra 10.13.4
After reinit npm and installing ipfs first there was this problem:
https://github.com/ipfs/js-ipfs/issues/1347#issuecomment-393991182
And then similar errors if I execute this command:
npm i --save https://github.com/ipfs/js-ipfsd-ctl
@vasco-santos By command above I'm trying to install new code by PR 262, which already merged in master
@Jonybang can you confirm this is still a problem with the latest version of ipfsd-ctl and js-ipfs?
Now all working fine by this code:
const IPFSFactory = require('ipfsd-ctl');
const IPFS = require('ipfs');
IPFSFactory
.create({ type: 'proc', exec: IPFS })
.spawn({ disposable: false }, async (err, ipfsd) => {
ipfsd.start({}, (err) => {
if(err) {
console.log("Error", err);
}
})
})
if i'm trying to call init instead of start: ipfsd throwing error Error Error: Not able to init from state: stopped, but i'm think this is fine.
This error seems to have returned on ^0.43.0, somehow... you can reproduce it by:
rm -rf node_modules package-lock.jsonnpm installnpm test"ipfs": "~0.43.0",
"ipfs-repo": "^1.0.1",
"ipfsd-ctl": "^3.1.0",
This is actually pretty interesting, wondering what changed in the package-lock.json to break this! I tried removing a ton of extraneous dependencies to see if something else got smuggled in, to no avail. Something in the dependencies listed above is causing it :/
Edit: trying with [email protected]
Got it in a sandbox, making a new issue: https://codesandbox.io/s/invalid-block-demo-d4oty?file=/src/index.js
Most helpful comment
@dryajov mind checking what's up here?