adamhalasz / uniqid

Unique ID Generator
https://adamhalasz.com
617 stars 49 forks source link

Error when network address is not available #5

Closed toaniel closed 8 years ago

toaniel commented 8 years ago

Hello, I'm using uniqid. If I turn my wifi off (no network connection), it exits with an error I can't handle.

$ gulp command

/Users/psyx/psyxgen/node_modules/uniqid/index.js:11
require('macaddress').one(function(error, macAddress){ if(error) throw error; address = macAddress; });
                                                                 ^
no interfaces found
$

Is there a workaround? Thanks.

adamhalasz commented 8 years ago

Hi @toaniel

Thanks for letting me know. I just tested it on OS X 10.11.4 without WiFi and it works fine. It is strange that it doesn't give you a mac address. Can you tell me what OS are you using?

I'm releasing a new version soon that will handle these errors more gracefully by the way.

Thanks, Adam

adamhalasz commented 8 years ago

Hey @toaniel please give it a try with the new v3.1.0 and let me know if it works for you. Please have a look at my answer on this issue to see what has changed.

Please keep in mind that without a Mac Address uniqid() cannot give you a completely Unique ID in multi core/multi machine environments! The new version falls back to the Process Safe method if a process id is available (with node.js you should always have one)

Thanks, Adam

adamhalasz commented 8 years ago

Hey @toaniel I'm closing this for now. Let me know if you still have this issue.