js-libp2p
js-libp2p copied to clipboard
libp2p-in-the-browser example has npm warnings
Repro steps:
- Check out js-libp2p master (I got ce58805e900f999eec96d8de585d6bf07363a26e)
- go to examples/libp2p-in-the-browser and
npm install
I get these warnings:
npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
… and similarly I get these warnings in my own project which is based on that example. The project does work despite the warnings.
I don't know what these warnings mean, but ws is a websocket library so I suspect this is actually some kind of minor problem with libp2p-websockets that the example inherited.
My expected behavior is that example code should not be printing alarming-looking warning messages that an entry-level user (and of course we are entry-level, we are looking at the example code…) might not be able to diagnose.
I am using npm 6.11.3. Issue type: Bug, Medium. I rate this bug higher than I otherwise might because its appearance in sample code can be misleading— I initially couldn't get the example code to work, and wasted a little bit of time trying to figure out if the "bufferutil" problem was the reason…
Both of those dependencies are optional in [email protected] and are properly listed in the peerDependenciesMeta field. npm @6.11.x shouldn't be printing the warnings since they are listed as optional.
The latest version of npm (6.14.2) is showing different warnings. I think it would be good to resolve these as best we can and add package lock files to the examples. We won't be able to solve for all the warnings with various package manager and their different versions, but we should try to reasonably mitigate this. Additionally specifying in the example that install warnings shouldn't cause issues might be helpful.
Closing due to staleness - please reopen if this is still breaking things