this worked for me, thx!
Hi, finally i manage how to solve this.
- Find @anysphere module path for your installation cursor-retrieval plugin
$ pwd
/vscode/cursor-server/bin/linux-arm64/001668006cc714afd397f4ef0d52862f5a095530/extensions/cursor-retrieval/node_modules/@anysphere
- Move to that directory
- Identify module version
$ npm list
[email protected] /vscode/cursor-server/bin/linux-arm64/001668006cc714afd397f4ef0d52862f5a095530/extensions/cursor-retrieval
āāā @anysphere/file-service-linux-x64-gnu@0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7 extraneous
āāā @anysphere/file-service@0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7 extraneous
In this case will be 0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7
$ export DETECTED_VERSION=0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7
- Update packages using this version
$ npm install @anysphere/file-service-linux-arm64-gnu@$DETECTED_VERSION --silent
$ npm install @anysphere/file-service@$DETECTED_VERSION --silent
Restart the container and it should work!
Thanks for sharing this solution. It worked for me!
Thanks for this. I modified the script above and wrote a simple script that I put in my devcontainer.json
to run as postCreateCommand:
"postCreateCommand": "bash -i -c './bin/arm64-setup'"
script below:
#!/bin/bash
# https://forum.cursor.com/t/codebase-indexing-no-longer-working-inside-dev-containers/17858/14
# =============================================================================
# Script Name: install_cursor_packages.sh
# Description: Installs specific npm packages based on a detected or provided version.
# Author: Your Name
# Version: 1.2.0
# Date: 2024-04-27
# =============================================================================
# Enable strict mode for better error handling
set -euo pipefail
# Initialize global variables
SILENT=""
USER_VERSION=""
DETECTED_VERSION=""
INSTALL_VERSION=""
VERSION_DIR=""
CURSOR_RETRIEVAL_DIR=""
CURSOR_SERVER_DIR=""
# =============================================================================
# Function: Display usage information
# =============================================================================
usage() {
cat <<EOF
Usage: $(basename "$0") [OPTIONS]
Options:
--silent Run script in silent mode.
--version <ver> Specify the version to use for npm install (allows downgrading).
-h, --help Display this help message and exit.
Examples:
# Run in verbose mode with automatic version detection
$(basename "$0")
# Run in silent mode with automatic version detection
$(basename "$0") --silent
# Run in verbose mode with a specific version for npm install
$(basename "$0") --version 1.2.3
# Run in silent mode with a specific version for npm install
$(basename "$0") --silent --version 1.2.3
# Display help
$(basename "$0") --help
EOF
exit 0
}
# =============================================================================
# Function: Parse command-line arguments
# =============================================================================
parse_args() {
while [[ $# -gt 0 ]]; do
case "$1" in
--silent)
SILENT="--silent"
shift
;;
--version)
if [[ -n "${2:-}" && ! "$2" =~ ^-- ]]; then
USER_VERSION="$2"
shift 2
else
echo "Error: --version requires a non-empty argument." >&2
usage
fi
;;
-h|--help)
usage
;;
-*|--*)
echo "Error: Unknown option: $1" >&2
usage
;;
*)
echo "Error: Unexpected argument: $1" >&2
usage
;;
esac
done
}
# =============================================================================
# Function: Enable debugging if not in silent mode
# =============================================================================
enable_debugging() {
if [[ -z "$SILENT" ]]; then
set -x
fi
}
# =============================================================================
# Function: Check for required dependencies
# =============================================================================
check_dependencies() {
local dependencies=(npm grep awk ls)
for cmd in "${dependencies[@]}"; do
if ! command -v "$cmd" &> /dev/null; then
echo "Error: Required command '$cmd' is not installed or not in PATH." >&2
exit 1
fi
done
}
# =============================================================================
# Function: Detect the version from existing directories
# =============================================================================
detect_version() {
local bin_dir="${HOME}/.cursor-server/bin/"
# List directories matching a 40-character hexadecimal pattern
VERSION_DIR=$(ls "$bin_dir" 2>/dev/null | grep -E '^[0-9a-f]{40}$' | head -n 1)
if [[ -z "$VERSION_DIR" ]]; then
echo "Error: No version directory found in ${bin_dir}" >&2
exit 1
fi
DETECTED_VERSION="$VERSION_DIR"
echo "Detected directory version: $DETECTED_VERSION"
# Set directory paths based on DETECTED_VERSION
CURSOR_RETRIEVAL_DIR="${HOME}/.cursor-server/bin/$VERSION_DIR/extensions/cursor-retrieval/"
CURSOR_SERVER_DIR="/vscode/cursor-server/bin/linux-arm64/$VERSION_DIR/extensions/cursor-retrieval/"
echo "Cursor Retrieval Directory: $CURSOR_RETRIEVAL_DIR"
echo "Cursor Server Directory: $CURSOR_SERVER_DIR"
}
# =============================================================================
# Function: Extract version from npm list
# =============================================================================
extract_version_from_npm() {
local anysphere_dir="$CURSOR_SERVER_DIR/node_modules/@anysphere"
if [[ ! -d "$anysphere_dir" ]]; then
echo "Error: Directory $anysphere_dir does not exist." >&2
exit 1
fi
# Change to the anysphere directory
cd "$anysphere_dir" || { echo "Failed to navigate to $anysphere_dir" >&2; exit 1; }
# Run npm list and capture its output
local npm_output
npm_output=$(npm list)
# Extract the version after @anysphere/file-service-linux-x64-gnu@
local extracted_version
extracted_version=$(echo "$npm_output" | grep -o '@anysphere/file-service-linux-.*-gnu@[^ ]*' | awk -F'@' '{print $3}')
if [[ -z "$extracted_version" ]]; then
echo "Error: Could not detect version from npm list." >&2
exit 1
fi
INSTALL_VERSION="$extracted_version"
echo "Detected install version from npm list: $INSTALL_VERSION"
}
# =============================================================================
# Function: Determine the version to use for npm install
# =============================================================================
set_install_version() {
if [[ -n "$USER_VERSION" ]]; then
INSTALL_VERSION="$USER_VERSION"
echo "Using user-provided version for npm install: $INSTALL_VERSION"
else
extract_version_from_npm
echo "Using detected version for npm install: $INSTALL_VERSION"
fi
}
# =============================================================================
# Function: Install required npm packages
# =============================================================================
install_packages() {
local directories=("$CURSOR_SERVER_DIR" "$CURSOR_RETRIEVAL_DIR")
for dir in "${directories[@]}"; do
if [[ -d "$dir" ]]; then
echo "Installing packages in $dir"
npm install --prefix "$dir" "@anysphere/file-service-linux-arm64-gnu@$INSTALL_VERSION" "$SILENT"
npm install --prefix "$dir" "@anysphere/file-service@$INSTALL_VERSION" "$SILENT"
else
echo "Warning: Directory $dir does not exist. Skipping." >&2
fi
done
}
# =============================================================================
# Function: Validate the install version format (optional)
# =============================================================================
validate_version() {
if [[ ! "$INSTALL_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Warning: Version '$INSTALL_VERSION' may not be in semantic versioning format (x.y.z)." >&2
# Optionally exit or proceed
# exit 1
fi
}
# =============================================================================
# Main function to orchestrate the script execution
# =============================================================================
main() {
parse_args "$@"
check_dependencies
enable_debugging
detect_version
set_install_version
validate_version
install_packages
}
# Execute the main function with all script arguments
main "$@"
Any progress on official support for this? The above script is working, thanks for that.
Thatās script no longer works with 0.44.5. Just stuck on loading⦠(with or without the script)
Same problem here, no indexing, been trying to fix this for hours without success. Tried all the suggested solutions
Looks like fix is not working anymore with the latest Cursor version. Itās so annoying because quality of response drops significantly without indexing.
Indexing is working fine in 0.44.9 in dev container without the script
not for me
Hm, still not working for me. So frustrating
Hey, we believe we might have a fix for this coming out soon, but weāre still testing it to make sure weāve solved it for good!
Sorry for the delay!
Can you be a little bit more specific? I canāt pause the Indexing, cause itās still in āLoadingā¦ā state, so I am pretty stuck atm.
You are literally forcing me to use GH Copilot
This is not working, even with the scripts, the process keeps dying:
2025-01-15 03:30:10.809 [info] Extension host with pid 5716 started
2025-01-15 03:30:10.810 [error] Error: EEXIST: file already exists, open ā/home/node/.cursor-server/data/User/workspaceStorage/4aa003aa81ce8b9031288a4e3f444182/vscode.lockā
2025-01-15 03:30:10.886 [info] Lock ā/home/node/.cursor-server/data/User/workspaceStorage/4aa003aa81ce8b9031288a4e3f444182/vscode.lockā: Could not acquire lock, checking if the file is stale.
2025-01-15 03:30:10.910 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: false, activationEvent: āonCommand:git.api.getRepositoriesā, root cause: vscode.git
2025-01-15 03:30:10.913 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: āonLanguageā
2025-01-15 03:30:10.914 [info] ExtensionService#_doActivateExtension vscode.tunnel-forwarding, startup: false, activationEvent: āonTunnelā
2025-01-15 03:30:10.915 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: āonLanguage:jsonā
2025-01-15 03:30:10.916 [info] ExtensionService#_doActivateExtension vscode.extension-editing, startup: false, activationEvent: āonLanguage:jsonā
2025-01-15 03:30:10.917 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: āonLanguage:jsonā
2025-01-15 03:30:10.918 [info] ExtensionService#_doActivateExtension vscode.npm, startup: false, activationEvent: āonLanguage:jsonā
2025-01-15 03:30:10.919 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: āonLanguage:jsoncā
2025-01-15 03:30:10.921 [info] ExtensionService#_doActivateExtension ms-vscode.vscode-typescript-tslint-plugin, startup: false, activationEvent: āonLanguage:javascriptā
2025-01-15 03:30:10.923 [info] ExtensionService#_doActivateExtension Prisma.prisma, startup: false, activationEvent: āonLanguage:javascriptā
2025-01-15 03:30:11.867 [info] Lock ā/home/node/.cursor-server/data/User/workspaceStorage/4aa003aa81ce8b9031288a4e3f444182/vscode.lockā: The pid 5609 appears to be gone.
2025-01-15 03:30:11.868 [info] Lock ā/home/node/.cursor-server/data/User/workspaceStorage/4aa003aa81ce8b9031288a4e3f444182/vscode.lockā: Deleting a stale lock.
2025-01-15 03:30:11.931 [info] Lock ā/home/node/.cursor-server/data/User/workspaceStorage/4aa003aa81ce8b9031288a4e3f444182/vscode.lockā: Lock acquired.
2025-01-15 03:30:11.934 [info] ExtensionService#_doActivateExtension yzhang.markdown-all-in-one, startup: true, activationEvent: āworkspaceContains:README.mdā
2025-01-15 03:30:12.351 [info] ExtensionService#_doActivateExtension vscode.markdown-math, startup: false, activationEvent: āapiā, root cause: yzhang.markdown-all-in-one
2025-01-15 03:30:13.057 [info] ExtensionService#_doActivateExtension vscode.git, startup: false, activationEvent: āonCommand:git.api.getRepositoriesā
2025-01-15 03:30:13.059 [info] ExtensionService#_doActivateExtension vscode.github, startup: false, activationEvent: ā*ā
2025-01-15 03:30:13.959 [info] Eager extensions activated
2025-01-15 03:30:13.961 [info] ExtensionService#_doActivateExtension anysphere.cursor-retrieval, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:13.962 [info] ExtensionService#_doActivateExtension anysphere.cursor-shadow-workspace, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:13.962 [info] ExtensionService#_doActivateExtension anysphere.cursor-tokenize, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:13.962 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:13.963 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:13.964 [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:13.964 [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: āonStartupFinishedā
2025-01-15 03:30:17.347 [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github, startup: false, activationEvent: āonStartupFinishedā
Version: 0.44.11
VSCode Version: 1.93.1
Commit: fe574d0820377383143b2ea26aa6ae28b3425220
Date: 2025-01-03T07:59:06.361Z
Electron: 30.5.1
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 24.2.0
Running inside a Microsoft Artifact Registry devcontainer. Iām pretty sure itās because cursor is loading the Mac (arm64) version of its indexing tools because the host computer is darwin-arm64, while the devcontainer is linux-arm64ā¦
I am going to try downgrading to 0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7
ā the script supports a --version
parameter. so run it ./bin/arm64-setup --version 0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7
worked for me when using version 0.0.0-30549ed4-6f41e022f7af079ff34c9d09cb1d5d616735c7e31ec0d732af0daec4758069f7
Anyone else got this error after trying to attach to a Docker container?
command āremote-containers.attachToRunningContainerā not found
is v0.327.0
fixed or did my company install this specific version?
Itās working natively now with Cursor 0.45+, as Dev Containers has been updated by bumping their VSCode fork version.
finally works for me with Cursor 0.45+