Dave Lin
Dave Lin

Reputation: 131

Can't run browser platform. Error: url.URL is not a constructor

I can't run all my cordova projects in browser platform. Please help me.

$ cordova platform rm browser
Removing browser from cordova.platforms array in package.json
$ cordova platform add browser
Using cordova-fetch for cordova-browser@^6.0.0
Adding browser project...
$ cordova run browser
Updating manifest.json with push properties…
url.URL is not a constructor

THNKS

Upvotes: 1

Views: 899

Answers (1)

Georges
Georges

Reputation: 81

Found a solution: edit file platforms/browser/cordova/lib/run.js

Comment line 57:

// var projectUrl = (new url.URL(`http://localhost:${server.port}/${startPage}`)).href;

And replace it with new line:

var projectUrl = `http://localhost:${server.port}/${startPage}`;

Works for me!

Upvotes: 4

Related Questions