Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'childrenNamed' of null #7

Open
goldenmean opened this issue Apr 27, 2015 · 3 comments
Open

Cannot read property 'childrenNamed' of null #7

goldenmean opened this issue Apr 27, 2015 · 3 comments

Comments

@goldenmean
Copy link

I have installed node-upnp-client v0.0.2 , nodeJS 0.12.2 on Ubuntu 11.10
I used the basic test example JS code to discover devices but I get below error about "Cannot read property "childrenNamed"

Any pointers about whats the fix, workaround.

/home/test/node_modules/node-upnp-client/lib/client.js:223
device.icon = device.baseUrl+dev.childNamed("iconList").childrenNamed("i
^
TypeError: Cannot read property 'childrenNamed' of null
at /home/test/node_modules/node-upnp-client/lib/client.js:223:62
at XmlElement.eachChild (/home/test/node_modules/node-upnp-client/node_modules/xmldoc/lib/xmldoc.js:72:18)
at IncomingMessage. (/home/test/node_modules/node-upnp-client/lib/client.js:210:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)

Test example used to discover upnp devices:

var upnpClient = require('node-upnp-client');
var cli = new upnpClient();

//start search

cli.searchDevices();

// listen for search terminated

cli.on('searchDevicesEnd', function() {
console.log('Servers'+ JSON.stringify(cli._servers))
console.log('Renderers'+ JSON.stringify(cli._renderers))
console.log('AVTransport'+ JSON.stringify(cli._avTransports))
console.log('ConnectionManagers'+ JSON.stringify(cli._connectionManagers))
});

// listen for added / removed devices

cli.on('updateUpnpDevice', function() {
console.log('Servers'+ JSON.stringify(cli._servers))
console.log('Renderers'+ JSON.stringify(cli._renderers))
console.log('AVTransport'+ JSON.stringify(cli._avTransports))
console.log('ConnectionManagers'+ JSON.stringify(cli._connectionManagers))
});

@goldenmean
Copy link
Author

Sorry wrong information about error code and test example is posted above..Below is the correct info
/home/ad17/node_modules/upnp-client/lib/upnp.js:82
self.requestParser = http.parsers.alloc();
^
TypeError: Cannot read property 'alloc' of undefined
at ControlPoint._initParsers (/home/ad17/node_modules/upnp-client/lib/upnp.js:82:38)
at new ControlPoint (/home/ad17/node_modules/upnp-client/lib/upnp.js:36:8)
at Object. (/home/ad17/mynodejs/node_upnp_1.js:4:20)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

Test example:
var upnp = require("upnp-client");

// First, create a client instance
var controlPoint = new upnp.ControlPoint();

controlPoint.on("DeviceAvailable", function(device) {
console.log(device.nt);
//-> "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
console.log(device.location);
//-> "http://192.168.0.1/root.sxml"
});

controlPoint.on("DeviceFound", function(device) {
console.log(device.st);
//-> "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
console.log(device.location);
//-> "http://192.168.0.1/root.sxml"
});

controlPoint.search('urn:schemas-upnp-org:device:InternetGatewayDevice:1');

@goldenmean
Copy link
Author

Versions of software used are: upnp-client v0.0.1 step: v0.0.5

@sebinsua
Copy link

sebinsua commented Jun 2, 2015

As far as I can see you need to use an old version of Node.

0.10 works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants