Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module not found: Error: Can't resolve 'net' in 'node_modules/stompjs/lib'

Got an issue where a stompJS-lib was not found, upon which I got the following error message:

Module not found: Error: Can't resolve 'net' in '/../../../.../../../angular-app/node_modules/stompjs/lib'
like image 686
S34N Avatar asked Jan 20 '19 09:01

S34N


2 Answers

The following command (which installs the missing dependencies):

 npm i net -S

This does not install random packages as assumed below. If you want the frontend to have some level of non-authoritative processing to be done on the client-side of those required dependencies, then this is the option to consider.

like image 169
S34N Avatar answered Oct 18 '22 15:10

S34N


To avoid installing random packages, you could add this into your Webpack configuration.

node: {
  net: 'empty',
},

The issue is caused by expecting the net package which is a package from Node.JS and does not exist in the browser.

If you want more information and explanations you can find it here.

like image 36
Arthur Costa Avatar answered Oct 18 '22 16:10

Arthur Costa