Cursor ide not open / error log

2024-11-14 10:12:47.026 [error] Error: Command failed: %windir%\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:905:11)
at execSync (node:child_process:977:15)
at node:electron/js2c/node_init:2:13164
at v (C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:49:402)
at C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:48:6600
at m (C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:48:6615)
at D (C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:110:1383)
at k (C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:110:1930)
at vt.startup (C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:121:58067)
at C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:123:1805
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Me.a (C:\Users\kimda\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js:123:1276)

I found and checked the log location and found the error.

C:\Windows\System32>echo %windir%
C:\WINDOWS

C:\Windows\System32>C:\WINDOWS\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
MachineGuid REG_SZ 6ad17724-1b1a-4958-xxxx-xxxxxxxxxxx

When checking in the CMD window, the system variables and paths seem to be fine.

The error was resolved by editing main.js in C:\Users\xxx\AppData\Local\Programs\cursor\resources\app\out\vs\code\electron-main.

I changed the async function v(y) function in 49:290 to the function below.

default:throw new Error(Unsupported platform: ${process.platform})}}async function v(y){
console.log(‘Executing v function with platform:’, O.platform);
let r;
try {
const command = “C:\WINDOWS\System32\REG.exe QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid”;
console.log(‘Attempting to execute command:’, command);
const execResult = (0, I.execSync)(command, { timeout: 5e3 });

    r = execResult.toString('utf8');
    console.log('Command executed successfully, result:', r);

} catch (execError) {
    console.error('Error during execSync:', execError);
    
    if (execError.status === 1) {
        console.error('Permission denied. Please ensure you have administrative privileges.');
    } else if (execError.code === 'ENOENT') {
        console.error('Command not found. Please check if the REG command is available.');
    } else {
        console.error('Unknown error occurred:', execError);
    }
    
    r = "FallbackMachineGuidValue";
}

let l;
try {
    console.log('Attempting to create hash with crypto...');
    l = (await new Promise((o, n) => { x(["crypto"], o, n) }).then(ke))
        .createHash("sha256")
        .update(r, "utf8")
        .digest("hex");
    console.log('Hash created successfully:', l);
} catch (cryptoError) {
    console.error('Error during crypto operation:', cryptoError);
    l = k.$9g();
}

return y ? r : l;

}