Skip to content

Error on Ubuntu 20.04 with wifi off #38

@chetbox

Description

@chetbox

Hi! Firstly, thanks for this great library!

I got this error using macaddress 0.5.2 on Ubuntu 20.04, but only when I turn off wifi . It looks to me like the output of a command isn't being parsed properly:

Failed to get MAC address [
  "Error: invalid iface: 'enx00e04d3a478a\n" +
    'lo\n' +
    "wlp0s20f3' (must conform to reg exp //^[a-z0-9]+$/i/)\n" +
    '    at Object../node_modules/macaddress/lib/getmacaddress.js.module.exports [as getMacAddress] (http://localhost:3000/account/index.js:102475:18)\n' +
    ...

The code that give this error looks like this:

import { one as macAddress } from 'macaddress';

async function foo() {
    try {
      return `MAC:${await macAddress()}`;
    } catch (error) {
      console.warn('Failed to get MAC address', error);
    }

    // return something else
    // ...
}

In our case we use the MAC address as a machine identifier but this means we cannot identify the machine when it is offline.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions