Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net module not found in stompjs #164

Open
Bugslogger opened this issue Aug 27, 2022 · 1 comment
Open

net module not found in stompjs #164

Bugslogger opened this issue Aug 27, 2022 · 1 comment

Comments

@Bugslogger
Copy link

ERROR in ./node_modules/stompjs/lib/stomp-node.js 11:8-22

this error comes from node modules inside stomp. how to fix this if anyone knows, please leave comment below.
as soon as it's urgent for me.

Thank you!

@Bappy1988
Copy link

I realise this is a really old issue, but if anyone else comes here looking for it like I did, this is likely because you're using stompjs from NPM in a browser based client app and the default import from the stompjs npm package is the node client that has a TCP fallback built in, which is not available in browsers.

Long story short, you can (possibly) work around it one of 3? ways.

  1. import the browser-only version of the file from lib like so;
    import { Stomp } from "stompjs/lib/stomp.js";

  2. include the 'net' npm package
    npm i net -S

  3. get webpack to mock the package for you
    node: {
    net: 'empty',
    },

for a more detailed explanation, see stack overflow comments;
https://stackoverflow.com/questions/54275069/module-not-found-error-cant-resolve-net-in-node-modules-stompjs-lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants