我已经安装了这个:
npm install --save getmac
并在我的 home.components.ts 中插入这段代码
import getMAC, { isMAC } from 'getmac';
在 ngOnInit 中,这段代码文本:
console.log(getMAC());
控制台错误是:
core.js:5873 ERROR Error: failed to get the MAC address
at getMAC (index.js:37)
at HomeComponent.ngOnInit (home.component.ts:15)
at callHook (core.js:3937)
at callHooks (core.js:3901)
at executeInitAndCheckHooks (core.js:3842)
at refreshView (core.js:11795)
at refreshDynamicEmbeddedViews (core.js:13142)
at refreshView (core.js:11800)
at refreshComponent (core.js:13217)
at refreshChildComponents (core.js:11508)
我哪里错了?