'ReferenceError: HTMLVideoElement is not defined javascript

I'm getting this error when trying to run npm start. Even if I remove the video file, I still get the same error and I'm using OpenCV with javascript. Any help would be appreciated.

const path = require('path');
const cv = require('opencv4js')
const express = require('express');
const app = express();
const server = require('http').Server(app)
const io = require('socket.io')(server);

// Video file
VIDEO_SOURCE = "test1.mp4";

const wCap = new cv.VideoCapture(0);

// get root url and send back a file
app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname, 'index.html'))
});

//image being caught every second
setInterval(()=> {
    const frame = wCap.read(); //return mat obj (theimage)
    const image = cv.imencode('.jpg', frame).toString('base64');
    io.emit('image', 'some data');
}, 1000);

server.listen(3000, () => {
    console.log('working');
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source