-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Uncaught TypeError: Cannot read property 'push' of null #1689
Comments
jsipfs version 0.33.0 |
browser version in google chrome |
and if i make the code "acc=[]",another error: Uncaught TypeError: cb is not a function it meas that,in module "pull-stream",you can call “reduce(reducer,[],callback)” or “reduce(reducer,callback)” . |
if i change the node-modules/ipfs/src/core/componets/ping.js to the following: module.exports = function ping(self) { all is ok. it seems that maybe the module "promisefy-es6" has some bugs |
await ipfs.ping("QmZ6YuHZUJd6k9hbJNaNUZBsWfwZGv62piZMU6oxHPBtDx")
collect.js:7 Uncaught TypeError: Cannot read property 'push' of null
at collect.js:7
at reduce.js:8
at drain.js:24
at f (index.js:84)
at Function.u [as push] (index.js:44)
at e.ping (ping-pull-stream.js:79)
at _getPeerInfo (index.js:339)
at s (get-peer-info.js:54)
at setImmediate.js:27
at setImmediate.js:40
at f (setImmediate.js:69)
at r (setImmediate.js:109)
i found the code like this(@ line 6 of node-modules/pull-stream/sinks/reduce.js):
module.exports = function reduce(reducer, acc, cb) {
if (!cb) cb = acc, acc = null
var sink = drain(function (data) {
acc = reducer(acc, data)
}, function (err) {
cb(err, acc)
})
if (arguments.length === 2)
return function (source) {
source(null, function (end, data) {
//if ended immediately, and no initial...
if (end) return cb(end === true ? null : end)
acc = data;
sink(source)
})
}
else
return sink
}
at some moment, "acc" would be set to "null",and the error caused by this resaon.
may be ,the code should be "if (!cb) cb = acc, acc = []"
The text was updated successfully, but these errors were encountered: