getcursor / cursor

The AI Code Editor
https://cursor.com
24.83k stars 1.55k forks source link

Crash on startup when running without admin privileges on Windows #1302

Open kevingatera opened 7 months ago

kevingatera commented 7 months ago

1) If you can, please include a screenshot of your problem

image

2) Please include the name of your operating system Windows 11

3) If you can, steps to reproduce are super helpful

  1. Run Cursor on Windows without admin privileges.
  2. Observe a silent crash
  3. Go to the data folder "%AppData%\Roaming\Cursor\logs" the error message: "ERROR: Registry editing has been disabled by your administrator."

The issue occurs because Cursor attempts to query the registry for the MachineGuid even when running without admin privileges, causing a crash when registry editing is disabled.

Temporary fix: in the file "%AppData%\Local\Programs\cursor\resources\app\out\vs\code\electron-main\main.js"

- m = b((0, P.execSync)(d[I.platform], { timeout: 5e3 }).toString());
+ try {
+   m = b((0, P.execSync)(d[I.platform], { timeout: 5e3 }).toString());
+ } catch (error) {
+   if (error.message.includes("Registry editing has been disabled by your administrator")) {
+     console.warn("Registry editing has been disabled. Skipping MachineGuid retrieval.");
+   } else {
+     throw error;
+   }
+ }

Then update the d object:

const d = {
- win32: `${{native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32",notdefined:""}[v()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,
+ win32: "%windir%\\System32\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",
};
Mathew-D commented 3 weeks ago

With version .41.3 I can't find those lines in main.js to try this fix. Has anyone got the new version running on Windows without admin rights?

mrlukeharrison commented 1 week ago

I do not have those lines of code in my main.js file also. Is there any update here?

plattenschieber commented 1 week ago

For me it worked, but I've also stayed on the old version. As this is a minified version, you'll need to watch out for a substring like execSync)( to catch the error.