holepunchto / hyperswarm

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

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

Open benzmuircroft opened 7 months ago

benzmuircroft commented 7 months 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 7 months 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 7 months ago

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

HDegroote commented 7 months 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