{"id":754,"hash":"e2c59d2866866bc4fa3f636c1ee1f7fc1cf34bd8c58dc2bef3c897e67670f8d3","pattern":"Uncaught TypeError: URL is not a constructor using WHATWG URL object support for electron","full_message":"I am trying to read a file using WHATWG URL object support here\n\nand I am getting this error: Uncaught TypeError: URL is not a constructor\n\nhere is my code:\n\n\r\n\r\nvar fs = require(\"fs\");                                     \r\nconst { URL } = require('url');\r\nvar dbPath = 'file://192.168.5.2/db/db.sqlite';\r\nconst fileUrl = new URL(dbPath);","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"I faced the same issue, then I looked into the url module and found a solution\n\nFor Node V6 use, \n\nconst URL = require('url').Url;\n\nor\n\nconst { Url } = require('url'); \n\nIf you look into the module, it exports 5 methods one of which is Url, so if you need to access Url, you can use either of the two methods","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/44738065/uncaught-typeerror-url-is-not-a-constructor-using-whatwg-url-object-support-for","votes":39,"created_at":"2026-04-19T04:51:36.213384+00:00","updated_at":"2026-04-19T04:51:36.213384+00:00"}