puncycode.toASCII is not a function - any ideas?


#1

In electron 1.0.2, this simple code seems to throw the mentioned error:

var parse_url = require('url').parse;
var url_parsed = parse_url('https://www.googleapis.com/oauth2/v3/tokeninfo');

As this is used by one some popular node libraries I’m wondering wtf is going on here? I can’t see anything on the net about anyone else having issues.

Node: 5.10.0, Chrome: 49.0.2623.75, Electron: 1.0.2


#2

I am also getting this error. It seems require('punycode') is simply returning a blank object instead of the actual module for some reason.

EDIT: Found out why. I have require.js for the non-node part of my app and it’s setting define in the global object. Because of this, the punycode module does not actually return an object.


#3

Use node LTS.