Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to get workspaces: [Error: ENOENT: no such file or directory, scandir ''] #4

Open
merewords opened this issue Nov 15, 2024 · 10 comments

Comments

@merewords
Copy link

Hi

Running on Windows11 Version 10.0.22621 Build 22621 I get this error despite the workspaces existing in the autodetected and configured workspaceStorage location

The link just displays
image

Here is the configuration page
image

File explorer confirming the workspaces exits in this location
image

And the next-server output
image

Any idea what causes this error?

Marc

@duythvn
Copy link

duythvn commented Nov 16, 2024

following as I got the same error

@runekaagaard
Copy link

+1 On Ubuntu Linux

@johanndiedrick
Copy link

+1 I get the same error! On MacOS

@zixinzuofo
Copy link

zixinzuofo commented Nov 20, 2024

+1 On WSL
I tried to locate the file containing "Failed to get workspaces:" and found that it is "src/app/api/workspaces/route.ts".
image
The error seems to be due to the WORKSPACE_PATH environment variable not being set.
image
I then exported WORKSPACE_PATH="/mnt/c/Users/USERNAME/AppData/Roaming/Cursor/User/workspaceStorage" in my terminal, and everything is working fine now!

@merewords
Copy link
Author

Thank you @zixinzuofo for the pointer...
I worked around this issue as follows:

Install dotenv (if not already installed):
npm install dotenv

Create a .env File (if it doesn’t exist) in the root of this project folder and add your workspaceStorage path - this is mine:
WORKSPACE_PATH=C:\Users\MW\AppData\Roaming\Cursor\User\workspaceStorage

Load the .env File in your route.ts: Add this line at the top of the file to load environment variables:
import 'dotenv/config';

Access the Variable: The route.ts will now read the value of WORKSPACE_PATH from .env using the original code:
(nothing to change if you have the following near the top of route.ts)
const workspacePath = process.env.WORKSPACE_PATH || '';

This got it working for me until someone finds a better fix

Marc

@runekaagaard
Copy link

Yeah this works on linux, thx guys!:

WORKSPACE_PATH=~/.config/Cursor/User/workspaceStorage npm run dev

@jmpavlick
Copy link

I'm on macOS.

I noticed that I needed to both set WORKSPACE_DIRECTORY to my fully-qualified path - i.e., given that my local user is john, I needed to set it to /Users/john/Library/Application Support/Cursor/User/workspaceStorage -

and I needed to set the Cursor Workspace Path value in the webapp config to the same value.

Using a ~/ to reference my home folder seems to not work; I suspect that it's not being expanded. Or something. I don't know.

But from zsh, I run

WORKSPACE_DIRECTORY="/Users/john/Library/Application Support/Cursor/User/workspaceStorage" npm run dev

and it works!

@SandroPacella
Copy link

set it to /Users/john/Library/Application Support/Cursor/User/workspaceStorage

Thank you @jmpavlick. That was enough to fix the issue for me on macOS.

@thomas-pedersen
Copy link
Owner

a fix has been merged, let me know if still an issue

@evnb
Copy link

evnb commented Jan 19, 2025

I still experienced this issue on Windows 11 but it worked after running $WORKSPACE_PATH="/mnt/c/Users/USERNAME/AppData/Roaming/Cursor/User/workspaceStorage" in my powershell terminal. Thanks @zixinzuofo for the fix and @thomas-pedersen for making this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants