Uncaught TypeError: URL is not a constructor using WHATWG URL object support for electron
Full error message
I am trying to read a file using WHATWG URL object support here
and I am getting this error: Uncaught TypeError: URL is not a constructor
here is my code:
var fs = require("fs");
const { URL } = require('url');
var dbPath = 'file://192.168.5.2/db/db.sqlite';
const fileUrl = new URL(dbPath);Solutionsource: stackoverflow \u2197
I faced the same issue, then I looked into the url module and found a solution For Node V6 use, const URL = require('url').Url; or const { Url } = require('url'); If 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
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/e2c59d2866866bc4fa3f636c1ee1f7fc1cf34bd8c58dc2bef3c897e67670f8d3hash \u00b7 e2c59d2866866bc4fa3f636c1ee1f7fc1cf34bd8c58dc2bef3c897e67670f8d3