apache / cordova-browser

Apache Cordova
Apache License 2.0
170 stars 85 forks source link

url.URL is not a constructor #82

Closed GeorgesDick closed 3 years ago

GeorgesDick commented 4 years ago

Bug Report

Problem

When trying to run (cordova run browser), got an error message "url.URL is not a constructor"

What is expected to happen?

cordova run browser is supposed to run the app in a browser window

What does actually happen?

Error message "url.URL is not a constructor"

Information

Found a work around: in file platforms/browser/cordova/lib/run.js change line 56 (or 57) form: var projectUrl = (new url.URL(http://localhost:${server.port}/${startPage})).href; to var projectUrl = http://localhost:${server.port}/${startPage};

Command or Code

Environment, Platform, Device

Windows 10

Version information

Checklist

aderowbotham commented 4 years ago

I immediately ran into this problem on macOS following the Cordova Getting Started Fast example with a fresh install.

breautek commented 3 years ago

URL class was added in Node in version 6.13.0 & 7.0.0. Without the version information filled out I can't say for sure, but educated guess tells me you may have been running an unsupported version of node.

I've confirmed the "Getting Started Fast" works.

Since nowadays the minimum supported Node version is Node 10, I'll be closing this ticket.