agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
681 stars 231 forks source link

Can't resolve 'dgram' #236

Open Luisquii opened 2 years ago

Luisquii commented 2 years ago

When I install onvif package on my Reactjs ("^18.2.0") app the next error is displayed

ERROR in ./node_modules/onvif/lib/discovery.js 77:15-44 Module not found: Error: Can't resolve 'dgram' in ..\node_modules\onvif\lib'

I installed dgram with the next command (in my project root folder): npm install dgram

also with: npm --save-dev dgram

But I'm still getting the same error, any idea?

I followed the next guide for the pollyfills issue: https://alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5

RogerHardiman commented 2 years ago

the ONVIF library runs on a NodeJS on the server side where you can make TCP and UDP network connections (like 'dgram uses'.

Are you trying to include it browser side? If so it won't work as browsers do not support TCP and UDP connections.

Luisquii commented 2 years ago

the ONVIF library runs on a NodeJS on the server side where you can make TCP and UDP network connections (like 'dgram uses'.

Are you trying to include it browser side? If so it won't work as browsers do not support TCP and UDP connections.

I guess thats the issue, I have the same package.json for reactjs frontend and mongodb backend cause is a really small app.

But I will try to separate the front from the back