I can talk confidently about my own use. The NodeJS library is meant to be used server side. When use on the server, it knows ‘fs’ (which is a library to access the file system). A long time ago (years ago) I mentioned this bug to the dev team, explaining that you can’t use their library for client code.
My workaround since then: I made a copy of the index file, removed the mention of ‘fs’, and I have a script to overide the node_modules index file with mine every time I update the modules.
This is completely dirty but has been working for years.
Oh I found my post look Node library requires lib unavailable for a web use - #4 by Ross_Grambo