Open merewords opened 2 weeks ago
following as I got the same error
+1 On Ubuntu Linux
+1 I get the same error! On MacOS
+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". The error seems to be due to the WORKSPACE_PATH environment variable not being set. I then exported WORKSPACE_PATH="/mnt/c/Users/USERNAME/AppData/Roaming/Cursor/User/workspaceStorage" in my terminal, and everything is working fine now!
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
Yeah this works on linux, thx guys!:
WORKSPACE_PATH=~/.config/Cursor/User/workspaceStorage npm run dev
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!
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.
a fix has been merged, let me know if still an issue
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
Here is the configuration page
File explorer confirming the workspaces exits in this location
And the next-server output
Any idea what causes this error?
Marc