automation-stack / node-machine-id Goto Github PK
View Code? Open in Web Editor NEWUnique machine (desktop) id (no admin privileges required)
License: MIT License
Unique machine (desktop) id (no admin privileges required)
License: MIT License
When run application(32bit) in window 64bit, I meet this errror
ERROR: The system was unable to find the specified registry key or value.
{ Error: Command failed: REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptog
raphy /v MachineGuid
ERROR: The system was unable to find the specified registry key or value.at checkExecSyncError (child_process.js:495:13) at execSync (child_process.js:535:13) at childProcess.(anonymous function) (ELECTRON_ASAR.js:685:22) at Object.c [as machineIdSync] (XXX\
dist\win-ia32-unpacked\resources\app.asar\node_modules\node-machine-id\dist\inde
x.js:1:7226)
And I found this link: http://superuser.com/questions/625568/unable-to-delete-registry-key-in-hklm-microsoft-windows-currentversion-run-via-c
It seems necessary to use webpack,What if we use vite packaging
Image-based environments have usually the same machine-id
Does it mean that Ghost cloned system has same machine id?
this error popping up while I'm running " reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2" /f
in my cmd.
thing is I'm facing an error called " no such interface supported " whenever i am opening a particular app in my pc(win10) , so i was trying out this command as a fix , but it showed me this error.
On Windows, when implemented with an express.js server, the command prompt seems to flash appear whenever the function is called.
Is there anyway to workaround this?
I was using electron-machine-id and updated to this thinking it would work in chrome?
Does it still require electron or NW?
ERROR in ./node_modules/node-machine-id/dist/index.js
Module not found: Error: Can't resolve 'child_process' in 'f:\Github\electron-store\node_modules\node-machine-id\dist'
@ ./node_modules/node-machine-id/dist/index.js 1:82-106 1:18348-18372
@ ./src/js/helper.js
@ ./src/purchase-entry.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/purchase-entry.js
I need to log in my user based on this unique id. Does this help? Also does this work for mobile too? since users will use the website on mobile too.
I perused the code a bit, but got lost and/or distracted.
At a high level, how does this library work?
When I implement this package on Angular Electron from https://github.com/maximegris/angular-electron, I get the same error of issue #29, but I am using Angular not Vue.js. I already tried verify if the application is Electron to execute the method machineId only when running on Electron, like, if (isElectron) id = machineIdSync(); But it is running into the same error. Thanks for listening.
I use node-machine-id in an Electron app that is packages with ASAR.
I see users who can't get the machine ID in their app. My error log includes this message:
Error: Error while obtaining machine id: Error: Command failed: %windir%\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid
Zugriff verweigert (= German for 'access denied')
at ChildProcess.exithandler (node:child_process:406:12)
at ChildPr...
I thought that the library doesn't use elevated rights. Is this specific to Electron? How can I work around this?
I use node-machine-id in my electron app and one of users reported this bug:
Just installed cerebro on Arch Linux and this happened:
cat: /var/lib/dbus/machine-id: No such file or directory
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Command failed: cat /var/lib/dbus/machine-id
cat: /var/lib/dbus/machine-id: No such file or directory
at checkExecSyncError (child_process.js:495:13)
at execSync (child_process.js:535:13)
at childProcess.(anonymous function) (ELECTRON_ASAR.js:685:22)
at c (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:309:7107)
at Object.<anonymous> (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:283:100)
at __webpack_require__ (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:21:30)
at Object.<anonymous> (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:159:20)
at __webpack_require__ (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:21:30)
at Object.<anonymous> (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:52:22)
at __webpack_require__ (/tmp/.mount_wzwsP7/usr/bin/resources/app.asar/main.js:21:30)
I solved it by creating a sym link to the file that actually was located at
/etc/machine-id
instead of/var/lib/dbus/machine-id
Hi,
Am I to understand from this information..
It is generated during OS installation and won't change unless you make another OS updates or reinstall.
..that the machine id would change if a user updates their OS X version (Yosemite to Sierra for example)?
If this is the case then it would be a problem for me. Can you clarify this?
Thanks, John
If I use this module in program A and totally unrelated program B, does it return the same Machine ID for for the same machine? And if so, how is this not a major privacy violation?
any exceptions thrown from expose
will cause machineId
promise to not resolve.
Promises have an implicit try-catch block, however this does not work for exceptions in the exec
callback.
I have used the both sync and async version of function , but no luck in getting Machine Id . Getting the error as mentioned in title at the time of starting the React Dev Server .
There is no /var/lib/dbus/machine-id
file in Arch linux by default, but /etc/machine-id
still exists
Uncaught (in promise) TypeError: (0 , p.exec) is not a function
^ Error message
I'm using Electron + ReactJS
Code in use:
import {machineId, machineIdSync} from 'node-machine-id';
let hwid = await machineId()
The machine id usually got only one like 12345, but now the double like 1234512345. Is that caused by cat command on two files?
cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null
i get this error while using it with electron and react
TypeError: (0 , p.exec) is not a function
any ideas whats wrong?
Thank you
I'm using ES6 on Windows and Electron. I've never used async or await, but I tried your example and I got javascript errors. Is there a better way of using it async?
Many ids I get are 03000200-0400-0500-0006-000700080009, in all platform, who has any idea
I would like to use this in Typescript 2.1, is there a type definition file for this?
I noticed that the latest version on NPM (1.1.10) doesn't have the latest code in master. In fact, the dist/index.js
file does not match the source index.js
file.
Would you please rebuild dist/index.js
and deploy the latest to NPM? Thanks!
I'm using this module for licensing my electron app. It's worked great, but a user just pointed out that they can run unlimited copies of my app on a Remote Desktop. Hmmm! That's interesting...
I found this guide, but I'm not clear how this module could change to provide a level of detection/identification for terminal services, and thus how I'd change my licensing.
Just thought I'd put this out for discussion, in case there's something obvious I'm overlooking. Feel free to close this issue if it's off-topic.
I have an electron app with this library running on rasperry pi. Unfortunately, on every raspberry pi the same machine id is generated. This is caused be the fact that all raspberries are based on the same image.
As a workaround I generated new machine-ids for each rapberry with dbus-uuidgen
and changed them in the respective files: /etc/machine-id
and /var/lib/dbus/machine-id
.
After installing node-machine-id (npm install node-machine-id)
After creating a "clean" project (typescript/angular2)
I got the following error:
ERROR in app/app.component.ts (2,40): Cannot find module 'node-machine-id'.)
ERROR in ./~/node-machine-id/dist/index.js
Module not found: Error: Can't resolve 'child_process' in '\machineID\node_modules\node-machine-id\dist'
---app.component.ts--
import { Component } from '@angular/core';
import {machineId, machineIdSync} from 'node-machine-id';
@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = machineId();
}
I am having lots of errors on Windows (App not loading properly) and after some digging, the error happens to be from this library that relies on running regedit in the background.
If I run this code:
const machine = require('node-machine-id');
machine.machineId().then((id) => {
console.log(id);
}).catch((err) => {
console.log(err);
})
I get the following error on Windows:
C:\Users\j\machineId> node index.js
Error: Error while obtaining machine id: Error: Command failed: %windir%\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid
ERROR: Registry editing has been disabled by your administrator.
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:314:20)
at Pipe.<anonymous> (net.js:676:12)
at C:\Users\j\machineId\node_modules\node-machine-id\dist\index.js:1:7964
at ChildProcess.exithandler (child_process.js:315:5)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:314:20)
at Pipe.<anonymous> (net.js:676:12)
The error hints that this user does not have admin privileges to run regedit, thus is unable to obtain the unique machine ID. Is there a way of resolving this issue?
Also, thank you for building this library!
Hi, I'm getting the following error:
import { machineIdSync } from 'node-machine-id';
^^^^^^^^^^^^^
SyntaxError: Named export 'machineIdSync' not found. The requested module 'node-machine-id' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'node-machine-id';
const { machineIdSync } = pkg;
at ModuleJob._instantiate (internal/modules/esm/module_job.js:120:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:165:5)
at async Loader.import (internal/modules/esm/loader.js:177:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
ERROR Command failed with exit code 1.
If I use:
import nodeMachineId from 'node-machine-id';
const { machineIdSync } = machineIdSync;
the code runs, but I get errors later on (after transpiling with Babel and packaging with pkg)
pkg/prelude/bootstrap.js:1697
throw error;
^
TypeError: Cannot read property 'machineIdSync' of undefined
at Object.<anonymous> (/snapshot/project/packages/desktop/.babel/storage/server.js:18:46)
at Module._compile (pkg/prelude/bootstrap.js:1751:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module.require (pkg/prelude/bootstrap.js:1676:31)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/snapshot/project/packages/desktop/.babel/index.js:5:15)
at Module._compile (pkg/prelude/bootstrap.js:1751:22)
Also, this is the transpiled output of the file
var _nodeMachineId = _interopRequireDefault(require("node-machine-id"));
const machineIdSync = _nodeMachineId.default.machineIdSync;
Please drop your suggestions in the comments
Thanks!
On importing import {machineId, machineIdSync} from 'node-machine-id' in app component then getting this error. Any work around for the same.
ERROR in ./node_modules/node-machine-id/dist/index.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\farhan\Desktop\ Farhan\Projects\BFMC\BFMClient\node_modules\node-machine-id\dist'
Hi!
I'm using your code, but I get this error
import {machineIdSync} from 'node-machine-id';
^^^^^^^^^^^^^
SyntaxError: The requested module 'node-machine-id' does not provide an export named 'machineIdSync'
In order to make it working, I import the module and then use default object to call exported function:
import ClientUtility from 'node-machine-id';
...
ClientUtility.machineIdSync({original: true})
My environment is node 13, so I'm using modules.
Is it possibile to import without default, or this is the right way to use it?
Thanks!
Someone has managed to use the node-machine-id within the Electron in Windows?
When we do the build, the software does not load, it is blank and does not display any error message.
Error: Command failed: cat /var/lib/dbus/machine-id
cat: /var/lib/dbus/machine-id: No such file or directory
After sudo ln -s /etc/machine-id /var/lib/dbus/machine-id
works fine
Error while obtaining machine id:
Error: Command failed: ioreg -rd1 -c IOPlatformExpertDevice
at ChildProcess.exithandler (node:child_process:406:12)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:390:28)
at Pipe.<anonymous> (node:net:687:12)
Hi,
If you are on a restricted environment where local group policy prevent access to registry editing tools, the "REG QUERY" command fails.
A workaround for me was to write a native tool (attached below), it work either on native and mixed environment.
Implementation
customer-service.component.ts
import * as _ from 'node-machine-id';
ngOnInit(): void { console.log(_);}
package.json
, "browser":{ "child_process": false, "crypto": false }
Error:
Uncaught ReferenceError: process is not defined at Object.<anonymous> (index.js:1) at n (index.js:1) at Object.<anonymous> (index.js:1) at n (index.js:1) at index.js:1 at index.js:1 at index.js:1 at Object.4brq (index.js:1) at __webpack_require__ (bootstrap:84) at Module.kiBU (customer-services.component.ts:3)
Hi,
Version 1.1.6 is broken on windows
I had to revert back to 1.1.4
Regards,
Jarle
Alpine Linux does not have /var/lib/dbus/machine-id
nor /etc/machine-id
maybe this gist can do the trick https://gist.github.com/KenanSulayman/8603521
Hi!
I have a NanoBSD deployment (FreeBSD 11.2 based). This deployment is not SMBIOS-enabled which results in missing value for kenv variable "smbios.system.uuid".
My suggestion is to use "sysctl -n kern.hostuuid" (which is more widely-present IMHO) in FreeBSD systems with or instead of "kenv -q smbios.system.uuid" to cover more FreeBSD-based systems.
Results are the same:
$ sysctl -n kern.hostuuid
774b2382-fb5f-4cb2-966b-e2beae8c9d51
$ kenv -q smbios.system.uuid
774b2382-fb5f-4cb2-966b-e2beae8c9d51
So I suggest the following command to use:
kenv -q smbios.system.uuid || sysctl -n kern.hostuuid
Error: Error while obtaining machine id: Error: Command failed: %windir%\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid
����: ϵͳ�Ҳ���ָ����ע������ֵ��
at ChildProcess.exithandler (child_process.js:312)
at ChildProcess.emit (events.js:315)
at maybeClose (internal/child_process.js:1021)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286)
at chunk-5ac52539.df366d92.js:1
at ChildProcess.exithandler (child_process.js:319)
at ChildProcess.emit (events.js:315)
at maybeClose (internal/child_process.js:1021)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286)
this error occurs when electron is packaged
When I install the package and try to use it, I get this error :
ERROR in ./node_modules/node-machine-id/dist/index.js Module not found: Error: Can't resolve 'child_process' in 'C:\Users\xxx\Source\Repos\xxx\node_modules\node-machine-id\dist' @ ./node_modules/node-machine-id/dist/index.js 1:82-106
I have used this module inside an electron based app. Can you confirm that there is no need for admin privileges?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.