I am a newcomer to Angular, and I have encountered a requirement in my project to retrieve the MAC address of the user's system.
To achieve this, I performed an NPM installation as shown below:
npm install --save macaddress
Next, I added the following code after the imports in my app.component.ts file:
var macaddress = require('macaddress');
Then, in my ngOnInit method, I included the following code:
macaddress.one(function (err, mac) {
console.log("Mac address for this host: %s", mac);
});
Upon implementing these changes and attempting to serve the project, I encountered the following error message:
ERROR in ./node_modules/macaddress/lib/windows.js
Module not found: Error: Can't resolve 'child_process' ...
Following the initial installation with npm install --save macaddress
, I also executed npm install -g
.
Despite these efforts, I have been unable to resolve the error. Any assistance in resolving this issue would be greatly appreciated.