jooy2 / machini

Get hardware specs, Machine ID(Device ID/UUID) information, and more for your current device. It's designed to be fast and lightweight so you can get just the information you need.
https://www.npmjs.com/package/machini
MIT License
6 stars 0 forks source link

Import Error #1

Closed snamheng closed 2 months ago

snamheng commented 2 months ago

How to use this library in NextJS project?

I got error below when trying to use it:

import { machineId } from 'machini';

export default function Home() {
  useEffect(() => {

    const getMachini = async () => {
      const machini = await machineId();
      console.log("machini", machini);
    };

    getMachini();
  }, []);
Import trace for requested module:
./app/page.tsx
 GET / 500 in 2143ms
 ⨯ ./node_modules/machini/dist/index.js:1:58
Module not found: Can't resolve 'child_process'
jooy2 commented 2 months ago

Hello, Thank you for using machini.

This module is used on the server, not the client. It requires a backend environment where the NodeJS API is available. Therefore, it is difficult to get the device ID of the client user; you will need to use another method, such as UUID, to achieve this.

Thank you.