libp2p / js-libp2p

The JavaScript Implementation of libp2p networking stack.
https://libp2p.io
Other
2.3k stars 440 forks source link

SyntaxError: The requested module '@multiformats/multiaddr-matcher' does not provide an export named 'IP_OR_DOMAIN' #2211

Closed christroutner closed 11 months ago

christroutner commented 11 months ago

Severity:

Critical - application crashes

Description:

Switching from js-ipfs v0.46.16 to 0.46.19, my application crashes on startup with the error below. It looks to me like a constant moved from a dev version to the master version of the software?

file:///home/trout/work/psf/code/ipfs-p2wdb-service/node_modules/libp2p/dist/src/identify/identify.js:7
import { IP_OR_DOMAIN } from '@multiformats/multiaddr-matcher';
         ^^^^^^^^^^^^
SyntaxError: The requested module '@multiformats/multiaddr-matcher' does not provide an export named 'IP_OR_DOMAIN'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

Steps to reproduce the error:

achingbrain commented 11 months ago

Can you paste the output of:

$ npm ls @multiformats/multiaddr-matcher

It should be the latest version - 1.1.0. If it's not, please delete any lockfiles you have and install again.

christroutner commented 11 months ago

Here is the output I got. helia-coord is my library. libp2p is a peer-dependency for that library.

trout@pop-os:~/work/psf/code/ipfs-p2wdb-service$ npm ls @multiformats/multiaddr-matcher
ipfs-p2wdb-service@4.0.0 /home/trout/work/psf/code/ipfs-p2wdb-service
├─┬ @libp2p/tcp@8.0.9
│ └─┬ @libp2p/utils@4.0.6
│   └── @multiformats/multiaddr-matcher@1.0.2 deduped
├─┬ helia-coord@1.2.2 -> ./../helia-coord
│ └─┬ libp2p@0.46.16
│   ├─┬ @libp2p/utils@4.0.5
│   │ └── @multiformats/multiaddr-matcher@1.0.2 deduped
│   └── @multiformats/multiaddr-matcher@1.0.2
├─┬ helia@2.1.0
│ ├─┬ @libp2p/webrtc@3.2.5
│ │ └── @multiformats/multiaddr-matcher@1.0.2 deduped
│ └─┬ @libp2p/webtransport@3.1.5
│   └── @multiformats/multiaddr-matcher@1.0.2 deduped
└─┬ libp2p@0.46.19
  └── @multiformats/multiaddr-matcher@1.0.2
achingbrain commented 11 months ago

Does helia-coord ship with a lockfile? It might be preventing npm taking the latest version that satisfies ^1.0.0.

christroutner commented 11 months ago

Deleting the package-lock.json file fixed the issue! Thank you!