onvif icon indicating copy to clipboard operation
onvif copied to clipboard

Can't resolve 'dgram'

Open Luisquii opened this issue 1 year ago • 2 comments

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

Luisquii avatar Jul 05 '22 18:07 Luisquii

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.

RogerHardiman avatar Jul 05 '22 18:07 RogerHardiman

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

Luisquii avatar Jul 05 '22 20:07 Luisquii