Failed to compile : ./node_modules/macaddress/lib/windows.js in Angular 5

前端 未结 2 1900
时光取名叫无心
时光取名叫无心 2020-12-04 03:51

I am new to Angular 5 ,as per my business need I need to get the user machine\'s mac address.For that I tried to implement the following...

相关标签:
2条回答
  • 2020-12-04 04:26

    This is an example of adding a module in app module file app.module.ts for example 'BrowserModule'

    import { NgModule }      from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { AppComponent }  from './app.component';
    
    @NgModule({
     imports:      [ BrowserModule ],
     declarations: [ AppComponent ],
     bootstrap:    [ AppComponent ]
    })
    export class AppModule { }
    
    0 讨论(0)
  • 2020-12-04 04:47

    You can't use this library from an Angular app. You can't query the user's mac address from a browser at all for security reasons. That library is intended for server-side node.js apps and has nothing to do with any client-side app's. More info here

    0 讨论(0)
提交回复
热议问题