Closed jimmyliao11 closed 3 years ago
What's your question?
Thanks for reply.
I want to get an IP, but this code will throw an error: TypeError: Cannot read property 'length' of undefined
https://github.com/SunilWang/node-os-utils/blob/master/lib/os.js#L101
if (platform === 'linux') {
for (i = 0; i < interfaces.eth0.length; i++) {
if (os.networkInterfaces().eth0[i].family === 'IPv4') {
ip = os.networkInterfaces().eth0[i].address
break
}
}
return ip
}