holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.08k stars 87 forks source link

I get Error: failed to create a n-api buffer #163

Open benzmuircroft opened 1 year ago

benzmuircroft commented 1 year ago
const you = {
  _id: 'benz'
}
const store = new Corestore(`./db/u/${you._id}`)
const swarm = new Hyperswarm()
swarm.on('connection', (connection) => store.replicate(connection))
const your = store.get({ name: `db/u/${you._id}` })
await your.ready()
swarm.join(your.discoveryKey)
benzmuircroft commented 1 year ago

happens actually on ether of:

const Hyperswarm = require('hyperswarm')
// and
const Hyperswarm = await import('hyperswarm')

both these lines cause the crash. I'm using node v20.9.0 and hyperswarm@next

benzmuircroft commented 1 year ago

error goes away with uninstalling hyperswarm@next and just use hyperswarm instead

HDegroote commented 1 year ago

The next tag points to an ancient version of hyperswarm (3.0.4), so the issue was simply using the next tag.

Would probably be better to delete that tag from npm though, to avoid confusion