sindresorhus/normalize-url

URL is not defined error

Closed this issue · 2 comments

with a fresh plain test.js


const normalizeUrl = require("normalize-url");
main();
function main(){
 let url = 'doctify.co.uk';
 website = normalizeUrl(url);
 console.log(website);
}
        const urlObj = new URL(urlString);
                       ^

ReferenceError: URL is not defined
    at normalizeUrl (/home/xxx/Dropbox/Node/Dealwatch/node_modules/normalize-url/index.js:93:17)
    at main (/home/xxx/Dropbox/Node/Dealwatch/test.js:6:12)
    at Object.<anonymous> (/home/xxx/Dropbox/Node/Dealwatch/test.js:3:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)

Upgrade your Node.js version.

ah crap, thanks :) had no idea apt wouldn't update node automatically. i was on version 8!