getcursor / cursor

The AI Code Editor
https://cursor.com
25.82k stars 1.6k forks source link

WSL: cursor command fails to find the correct entrypoint #807

Open LudwigStumpp opened 1 year ago

LudwigStumpp commented 1 year ago

Issue

Calling cursor command on WSL2 fails

To use Cursor with the Windows Subsystem for Linux, please install Cursor in Windows and uninstall the Linux version in WSL. You can then use the `cursor` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Cursor with the environment variable DONT_PROMPT_WSL_INSTALL defined.
/mnt/c/Users/ludwi/AppData/Local/Programs/cursor/resources/app/bin/cursor: 62: /mnt/c/Users/ludwi/AppData/Local/Programs/cursor/resources/app/bin/../cursor: not found

Specification

WSL2 Path has

Note

Has anyone experienced the same issue or has an idea for me to try out?

ArcAnya commented 1 year ago

Not exactly solving the issue, but just in case fyi - had a similar issue and ended up adding the WSL extension to the Cursor IDE - now using the WSL terminal / Cursor there and that's working well for me atm.

LudwigStumpp commented 1 year ago

Not exactly solving the issue, but just in case fyi - had a similar issue and ended up adding the WSL extension to the Cursor IDE - now using the WSL terminal / Cursor there and that's working well for me atm.

Hi, thanks for your additional input on this. Indeed for me within the WSL extension I am also able to open any folder on the WSL from within the IDE. However I would like to be able to use the cursor command from the WSL terminal (as it works the same for VSCode).

mfaizan1 commented 1 year ago

Although this is not a blocker but it is really convenient to open your folders from wsl terminal. facing exactly same issue.

ddwang commented 1 year ago

For some reason the default cursor shell script is very different from the equivalent code script from VSCode. Maybe it was forked from an earlier branch?

In any case, I took the latest VSCode code script and modified it for Cursor and WSL. It works well for me and I'm able to launch Cursor directly from a WSL prompt, e.g.:

$ cursor .

Here's the gist: https://gist.github.com/ddwang/0046da801bcb29d241869d37ad719394

To use, simply replace your cursor script, usually found at /mnt/c/Users/<USER_NAME>/AppData/Local/Programs/cursor/resources/app/bin/cursor

ksumesh431 commented 1 year ago

@ddwang your script works perfectly for me, but it downloads the vs code server every time I run "cursor ." Unlike vs code which just does that once and opens normally on subsequent runs

llllvvuu commented 1 year ago

Another use case is to apply the $PATH from the Terminal to Cursor.

vincentsch commented 9 months ago

I use @ddwang's script and so far it is working. But I have problems opening two or more projects at the same time from WSL in Cursor. Having opened a WSL project in Cursor and then starting Cursor from WSL in a different project directory, Cursor starts but then displays the error message "Could not fetch remote environment".

vincentsch commented 9 months ago

Another observation is that I have to repeat the process of replacing the script every few days. The script is apparently being reset to its original state on a regular schedule.

I can also no longer start the original VSCode with code . Instead, I keep getting the following error message:

Unable to determine app path from symlink : /mnt/c/Users//AppData/Local/Programs/cursor/resources/app/bin/code

ddwang commented 9 months ago

@vincentsch thanks for the debugging. I'll take a look this wknd and hopefully resolve these issues

addiaddiaddi commented 8 months ago

@vincentsch thanks for the debugging. I'll take a look this wknd and hopefully resolve these issues

Were you able to resolve this?

schlich commented 8 months ago

I hope someone is working on this! I love using Cursor on my work macOS machine, but this is a blocker for me on my home Windows machine

sandeepnmenon commented 7 months ago

+1 Same issue on my WSL

buencons commented 5 months ago

Still having this issue as well for anyone else running into this post. Fresh Win11 image + WSL2 install. Can connect to WSL remote when inside Cursor but can't do it through WSL terminal. Also tried the "Fix WSL install" through the command palette.

dkarelov commented 4 months ago

Same here - still does not work from the console directly.

0x33dm commented 4 months ago

any updates on this?

swayducky commented 4 months ago

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

0x33dm commented 4 months ago

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

this worked for me, thanks a lot.

I didn't find cursor on my windows variables tough, so maybe i got a slightly different install from you as i just installed this on my windows machine a couple days ago.

Remove "c:\Users\\AppData\Local\Programs\cursor\resources\app\bin" from Windows Environment Settings

0x33dm commented 4 months ago

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

today i got this error:

ln: failed to create symbolic link '/home/xxx/.cursor-server/bin//bee043c1bb0095dab94043787985ccfc7cc38e50/bin/remote-cli/code': File exists

and when i opened cursor it seems it downloaded the WSL server again :(

0x33dm commented 4 months ago

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

Rebooted my computer and now i get this

$ cursor .
ln: failed to create symbolic link '/home/xxx/.cursor-server/bin//1252dd54bee0d8caa777cd58df6ab01192a69c30/bin/remote-cli/code': File exists
/home/hems/.local/bin/cursor: 87: /mnt/c/Users/xxx/AppData/Local/Programs/cursor//Cursor.exe: not found
0x33dm commented 4 months ago

Rebooted my computer and now i get this

$ cursor .
ln: failed to create symbolic link '/home/xxx/.cursor-server/bin//1252dd54bee0d8caa777cd58df6ab01192a69c30/bin/remote-cli/code': File exists
/home/hems/.local/bin/cursor: 87: /mnt/c/Users/xxx/AppData/Local/Programs/cursor//Cursor.exe: not found

and if i go to C:\Users\xxx\AppData\Local\Programs\cursor the entire folder is empty.

i had to download cursor again and install and it works again.

Cursor on WSL seems very unreliable. I wonder why the entire folder got wiped.

Maybe i accepted some update pop up and don't remember it. weird.

Xnuvers007 commented 4 months ago

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

it's work for me

TimofeyBiryukov commented 3 months ago

Hvaing the same issue on WSL cursor . command will output:

image

To use Cursor with the Windows Subsystem for Linux, please install Cursor in Windows and uninstall the Linux version in WSL. You can then use the `cursor` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Cursor with the environment variable DONT_PROMPT_WSL_INSTALL defined.
./cursor: 62: ./../cursor: not found
jjovalle99 commented 3 months ago

Having the same issue.

cafesao commented 2 months ago

Having the same issue.

x-ray-s commented 2 months ago

[When VSCode or Cursor updates,cursor perhaps have some problem. Use the following script to resolve.

  1. cd /usr/local/sbin/, create a file, mine is fix-cursor
  2. paste code below
    #! /bin/bash
    win_cursor_path="/mnt/c/Users/WINUSERNAME/AppData/Local/Programs/cursor/resources/app/bin/"
    cd $win_cursor_path
    wget -O cursor.sh https://gist.githubusercontent.com/ddwang/0046da801bcb29d241869d37ad719394/raw/088836e0d946de07a82c245066ef07ddc35e9f53/cursor.sh
    mv cursor cursor.backup
    mv cursor.sh cursor
  3. Replace WINUSERNAME by your own
  4. Give permissions to shell sudo chmod 777 fix-cursor, and refresh environment source ~/.zshrc or source ~/.bashrc
  5. When cursor was not work, fix-cursor can fix it.

https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

This's better than me.

MediconcenVictor commented 2 months ago

When VSCode or Cursor updates,cursor perhaps have some problem. Use the following script to resolve.

  1. cd /usr/local/sbin/, create a file, mine is fix-cursor
  2. paste code below
#! /bin/bash
win_cursor_path="/mnt/c/Users/WINUSERNAME/AppData/Local/Programs/cursor/resources/app/bin/"
cd $win_cursor_path
wget -O cursor.sh https://gist.githubusercontent.com/ddwang/0046da801bcb29d241869d37ad719394/raw/088836e0d946de07a82c245066ef07ddc35e9f53/cursor.sh
mv cursor cursor.backup
mv cursor.sh cursor
  1. Replace WINUSERNAME by your own
  2. Give permissions to shell sudo chmod 777 fix-cursor, and refresh environment source ~/.zshrc or source ~/.bashrc
  3. When cursor was not work, fix-cursor can fix it.

I got this error

--2024-09-14 05:11:28--  https://gist.githubusercontent.com/ddwang/0046da801bcb29d241869d37ad719394/raw/088836e0d946de07a82c245066ef07ddc35e9f53/cursor.sh
Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.111.133, ...
Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2154 (2.1K) [text/plain]
Saving to: ‘cursor.sh’

cursor.sh                     100%[=================================================>]   2.10K  --.-KB/s    in 0.001s

2024-09-14 05:11:28 (4.02 MB/s) - ‘cursor.sh’ saved [2154/2154]

mv: cannot move 'cursor' to 'cursor.backup': Is a directory
mv: cannot move 'cursor.sh' to 'cursor': Is a directory
x-ray-s commented 2 months ago

@MediconcenVictor U can remove cursor, it is a folder in your system. cd /mnt/c/Users/WINUSERNAME/AppData/Local/Programs/cursor/resources/app/bin/" rm -rf cursor

danmayer commented 2 months ago

is this being worked on as it broke the CLI for vs code and cursor never worked... so it is a bit annoying that it broke another tool...

Soecka commented 2 months ago

I encountered a related issue. When I run echo $PATH in the VS Code terminal using Bash, I observed the following output:

xxxx:/c/Users/xxxx/AppData/Local/pnpm:xxxx

Additionally, within the cursor position, I found:

xxxx:%PNPM_HOME%:xxxx

This discrepancy seems to be causing the problem.

0xWerz commented 2 weeks ago

Just run this:

echo 'export PATH="$PATH:/mnt/c/Users/<YOUR_USERNAME>/AppData/Local/Programs/cursor/resources/app/bin"' >> ~/.bashrc
source ~/.bashrc