js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

npm @latest is a broken release

Open calummoore opened this issue 2 years ago • 4 comments

Version:

0.37.3

Platform:

Mac OSX arm64 (m1) Monterey

Severity:

Critical

Description:

If you install npm i libp2p you get a broken version of libp2p. You have published a later working version (0.37.3-05e8e7e), but that is not tagged with latest, so most people are still downloading the broken version.

Steps to reproduce the error:

npm install libp2p

Use code from chat examples folder, but with libp2p installed from npm.

Other related tickets (probably due to the above)

#1302 #1291

calummoore avatar Jul 26 '22 11:07 calummoore

I can confirm that installing version 0.37.3-05e8e7e instead of latest fixes issue #1302

nickreynolds avatar Jul 26 '22 21:07 nickreynolds

Using 0.37.3-05e8e7e also fixed the chat example for me.

RafaRed avatar Jul 30 '22 02:07 RafaRed

Using latest or 0.37.3-05e8e7e fails for me. Running on windows 11, node v16.15.1

import process from 'node:process'
import { createLibp2p } from 'libp2p'
import { TCP } from '@libp2p/tcp'
import { Noise } from '@chainsafe/libp2p-noise'
import { Mplex } from '@libp2p/mplex'
import { multiaddr } from 'multiaddr'

const node = await createLibp2p({
  addresses: {
    // add a listen address (localhost) to accept TCP connections on a random port
    listen: ['/ip4/127.0.0.1/tcp/0']
  },
  transports: [new TCP()],
  connectionEncryption: [new Noise()],
  streamMuxers: [new Mplex()]
})

// start libp2p
await node.start()
console.log('libp2p has started')

// print out listening addresses
console.log('listening on addresses:')
node.getMultiaddrs().forEach((addr) => {
  console.log(addr.toString())
})

// ping peer if received multiaddr
if (process.argv.length >= 3) {
   const ma = multiaddr(process.argv[2])

   console.log(`pinging remote peer at ${process.argv[2]}`)
  const latency = await node.ping(ma)
  console.log(`pinged ${process.argv[2]} in ${latency}ms`)
} else {
  console.log('no remote peer address given, skipping ping')
}

const stop = async () => {
  // stop libp2p
  await node.stop()
  console.log('libp2p has stopped')
  process.exit(0)
}

process.on('SIGTERM', stop)
process.on('SIGINT', stop)

Runs ok without parameters, but when I run a second instance passing the address on the command line it fails with : node:internal/process/esm_loader:94 internalBinding('errors').triggerUncaughtException( ^

[AggregateError: All promises were rejected]

craigbroadbear avatar Aug 06 '22 06:08 craigbroadbear

Using the tagged version also fixed my problems dialing peers, can you please publish a fixed version so this won't affect other people?

tmpfs avatar Aug 08 '22 01:08 tmpfs

We published a new version 0.38!

mpetrunic avatar Aug 30 '22 15:08 mpetrunic