claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Error installing VS Code extension: 1: ENOENT Please restart your IDE and try again.

Open fcoury opened this issue 7 months ago • 23 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [x] Other: Claude Code
  • Claude CLI version: v1.0.1
  • Operating System: macOS 15.4
  • Terminal: VSCode Terminal

Bug Description

 Claude Code Status v1.0.1

 Working Directory 
  L /Users/fcoury/code/paypol

 IDE Integration • /config
 ⚠  Error installing VS Code extension: 1: ENOENT
    Please restart your IDE and try again.

 Account • /login
  L Login Method: Claude Max Account (20x)
  L Email: ...

 Memory • /memory
  L project: CLAUDE.md

 Model • /model
  LDefault Uses the best available model for Max usage limits (currently
   Opus)

Steps to Reproduce

  1. Open VSCode terminal
  2. Type claude and enter
  3. Type /status

Expected Behavior

VSCode Extension is Installed

Actual Behavior

Error installing VS Code extension: 1: ENOENT Please restart your IDE and try again.

fcoury avatar May 22 '25 21:05 fcoury

From the same terminal, does which code resolve? If not, in VSCode can you try running the command Shell Command: Install 'code' command in PATH?

blois avatar May 22 '25 21:05 blois

From the same terminal, does which code resolve? If not, in VSCode can you try running the command Shell Command: Install 'code' command in PATH?

It does:

> $ which code
/usr/local/bin/code

> $ echo $TERM_PROGRAM
vscode

fcoury avatar May 22 '25 21:05 fcoury

What does code --help return - is it actually VSCode or any chance it points to Cursor?

igorkofman avatar May 22 '25 21:05 igorkofman

What does code --help return - is it actually VSCode or any chance it points to Cursor?

Here it goes:

> $ code --help | head -10
Visual Studio Code 1.100.2

Usage: code [options][paths...]

To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')

Options
  -d --diff <file> <file>                    Compare two files with each
                                             other.
  -m --merge <path1> <path2> <base> <result> Perform a three-way merge by
...

fcoury avatar May 22 '25 22:05 fcoury

A few more data points:

  • Thought it could be related to the fact that I use fish, tried with bash and zsh and same issue
  • v1.0.2 just came out, upgraded but same issue
  • Tried it with cursor as well -- same error

fcoury avatar May 22 '25 22:05 fcoury

i am experiencing the same issue, also with v1.02.

Claude CLI version: v1.0.2 Operating System: macOS 15.5 (x86) Terminal: VSCode Terminal

markwaddle avatar May 22 '25 22:05 markwaddle

It works after I manually installed the extension:

fcoury@mba ~/.c/l/n/@anthropic-ai/claude-code/vendor
> $ code --install-extension claude-code.vsix
Installing extensions...
Extension 'claude-code.vsix' was successfully installed.

> $ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /Users/fcoury/code/paypol                  │
╰───────────────────────────────────────────────────╯


> /ide 
  ⎿  Connected to Visual Studio Code.

╭───────────────────────────────────────────────────────────────────────────╮
│ >                                                                         │
╰───────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts                                                         ◯

fcoury avatar May 22 '25 22:05 fcoury

Why can't I install claude-code extension in mac os but works perfectly in ubuntu? I am following their guide by using claude in the integrated terminal for vs-code but it's not working in macos. Claude-code extension not even exists in vs-code extension marketplace at all. But this issue is specific to mac-os (for vs-code, windsurf, and cursor)

kartikmandar avatar May 22 '25 23:05 kartikmandar

Also when using the /config inside claude repl session, macos doesn't show diff auto option at all, while ubuntu does!!

kartikmandar avatar May 22 '25 23:05 kartikmandar

Same issue while using nvm. Manual installation worked: code --install-extension ~/.nvm/versions/node/v22.7.0/lib/node_modules/@anthropic-ai/claude-code/vendor/claude-code.vsix

MainAero avatar May 23 '25 05:05 MainAero

Installing it manually helped! I used this to find the extension: find ~ -name "*.vsix" 2>/dev/null

dawidstruzik avatar May 23 '25 05:05 dawidstruzik

I was also able to install manually - thank you @fcoury ! /status shows:

Claude Code Status v1.0.2

 Working Directory 
  L /home/(...)

 IDE Integration • /config
 ✔  Connected to VS Code extension
 ⚠  Error installing VS Code extension: 1: ENOENT
    Please restart your IDE and try again.

I imagine the cause in my case might be that I have code-insiders installed, and code is an alias:

$ which code
code: aliased to code-insiders
$ which code-insiders
/home/(...)/.vscode-server-insiders/bin/(...)/bin/remote-cli/code-insiders

Running in Ubuntu in WSL2.

gusbicalho avatar May 23 '25 16:05 gusbicalho

I was also able to install manually - thank you @fcoury ! /status shows:

You're welcome! Glad you were able to install it!

I imagine the cause in my case might be that I have code-insiders installed, and code is an alias:

$ which code
code: aliased to code-insiders
$ which code-insiders
/home/(...)/.vscode-server-insiders/bin/(...)/bin/remote-cli/code-insiders

This is pure speculation and some analysis of their minimized code, but I think they use the TERM_PROGRAM env var to determine it:

> $ echo $TERM_PROGRAM
vscode

If yours is also set to vscode inside the Insiders (!) terminal, I don't think there should be a problem identifying the environment you're running on. But again, not 100% sure.

fcoury avatar May 23 '25 16:05 fcoury

TERM_PROGRAM is indeed set to vscode - which I think is why claude attempts to install the extension. If I run claude in a normal WSL terminal outside VSCode, /status does not show the IDE Integration • /config section.

However the 1: ENOENT error suggests it tried to install something, but failed to find a file or directory...

It seems they essentially call execFile('code',...) - so it fails in my case because code is an alias, not an executable.

gusbicalho avatar May 23 '25 16:05 gusbicalho

However the 1: ENOENT error suggests it tried to install something, but failed to find a file or directory...

It seems they essentially call execFile('code',...) - so it fails in my case because code is an alias, not an executable.

Ah good catch! I thought it was a symlink and just now realized it's actually an alias 😁

fcoury avatar May 23 '25 16:05 fcoury

Using a symlink instead of an alias does the trick:

~ ln -s "$(which code-insiders)" ~/bin/code
~ which code
/home/(...)/bin/code

And now if I run claude /status inside VSCode terminal I get:

Claude Code Status v1.0.2

 Working Directory 
  L /home/(...)

 IDE Integration • /config
 ✔  Connected to VS Code extension
 ✔  Installed VS Code extension

So yeah it seems the Claude CLI is not quite smart enough in how it detects and runs the VSCode CLI - although I'm not sure how it could do better

gusbicalho avatar May 23 '25 17:05 gusbicalho

Using a symlink instead of an alias does the trick:

In mine and other mac user's case it weirder:

> $ which code
/usr/local/bin/code

> $ ls -lad /usr/local/bin/code
lrwxr-xr-x - root  7 Jan  2024 /usr/local/bin/code -> '/Applications/Visual Studio Code.app/Contents/Resources/app/bin'/code

> $ ls -la '/Applications/Visual Studio Code.app/Contents/Resources/app/bin'/code
.rwxr-xr-x 1.2k fcoury 14 May 19:12 '/Applications/Visual Studio Code.app/Contents/Resources/app/bin'/code

But we still get the ENOENT error.

fcoury avatar May 23 '25 18:05 fcoury

Yeah similar setup.

MacOS fish shell (My suspect)

$ which code /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code

(apparently I added this directly to my path? Can't remember doing it).

$ ls -la -rwxr-xr-x 1 blobmueller staff 1160 May 15 07:05 /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code*

but

IDE Integration • /config ✔ Connected to VS Code extension ⚠ Error installing VS Code extension: 1: ENOENT Please restart your IDE and try again.

Also a few years ago I had code-insiders installed - but now it's uninstalled and I'm running vanilla only.

lobochrome avatar May 26 '25 01:05 lobochrome

Okay for me fixed it: my fish.config had a set to add the code binary directly to the PATH - but I also had the symlink present in /usr/local/bin removing /Applications/Visula Studio Code.app/... from PATH fixed it.

lobochrome avatar May 26 '25 01:05 lobochrome

Okay for me fixed it: my fish.config had a set to add the code binary directly to the PATH - but I also had the symlink present in /usr/local/bin removing /Applications/Visula Studio Code.app/... from PATH fixed it.

Unfortunately not the case for me:

> $ ls -la /usr/local/bin/code
lrwxr-xr-x - root 15 Dec  2024 /usr/local/bin/code -> '/Applications/Visual Studio Code.app/Contents/Resources/app/bin'/code

> $ echo $PATH | grep Visual
<empty>

fcoury avatar May 26 '25 01:05 fcoury

I have the same issue on MacOS. I have node and vscode installed through homebrew (cask). I manually installed the extension and it does show up in the extensions on vscode, but doesn't seem to be installed through claude code /status even though it is connected to the extension.

$ echo $SHELL
/opt/homebrew/bin/bash
$ bash --version
GNU bash, version 5.2.37(1)-release (aarch64-apple-darwin23.4.0)

Claude code doesn't seem to see it.

 Claude Code Status v1.0.3

 Working Directory 
  L /Users/cvardema/dev/git/

 IDE Integration • /config
 ✔  Connected to VS Code extension
 ⚠  Error installing VS Code extension: 1: ENOENT
    Please restart your IDE and try again.
$ ls -lart /opt/homebrew/bin/claude
lrwxr-xr-x@ 1 cvardema  admin  52 May 25 09:27 /opt/homebrew/bin/claude -> ../lib/node_modules/@anthropic-ai/claude-code/cli.js

Code exe is installed in the homebrew /opt/homebrew/bin

 ls -lart /opt/homebrew/bin/code
lrwxr-xr-x  1 cvardema  admin  68 Feb 24  2023 /opt/homebrew/bin/code -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code

The extension bundle is in /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/vendor where I installed it manually using code --install-extension

charlesvardeman avatar May 27 '25 13:05 charlesvardeman

I encountered the same issue. I have set the default login shell in VSCode to fish. After changing it to zsh and launching claude, it installed successfully.

$ code --version
1.100.2
848b80aeb52026648a8ff9f7c45a9b0a80641e2e
arm64

$ claude --version
1.0.5 (Claude Code)

However, when I changed the login shell back to fish, an error occurred.

 IDE Integration • /config
 ✔  Connected to VS Code extension
 ⚠  Error installing VS Code extension: 1: ENOENT
    Please restart your IDE and try again.

kindaidai avatar May 29 '25 05:05 kindaidai

Thanks for your patience folks. We're tracked down the issue (mostly should impact folks using Fish inside VSCode). The fix should be out shortly, will update again once it's out!

igorkofman avatar Jun 03 '25 00:06 igorkofman

This should be fixed in 1.0.10 - please let us know if it works for you!

igorkofman avatar Jun 03 '25 21:06 igorkofman

Same issue while using nvm. Manual installation worked: code --install-extension ~/.nvm/versions/node/v22.7.0/lib/node_modules/@anthropic-ai/claude-code/vendor/claude-code.vsix

This worked! thanks

dkarni avatar Jun 06 '25 19:06 dkarni

Still experiencing the same issue as today

 ⚠  Error installing Cursor extension: 1: 1 Error: End of central directory record signature not found. Either not a zip file, or file is truncated.
        at Ef (file:///Applications/Cursor.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:28755)
        at file:///Applications/Cursor.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:30083
        at /Applications/Cursor.app/Contents/Resources/app/node_modules/yauzl/index.js:40:7
        at /Applications/Cursor.app/Contents/Resources/app/node_modules/yauzl/index.js:190:5
        at Immediate.<anonymous> (/Applications/Cursor.app/Contents/Resources/app/node_modules/yauzl/index.js:705:38)
        at process.processImmediate (node:internal/timers:483:21) {
      code: 'Extract',
      name: 'Extract'
    }
    Failed Installing Extensions: file:///opt/homebrew/lib/node_modules/%40anthropic-ai/claude-code/vendor/claude-code.vsix
    (node:6881) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option
    --force-node-api-uncaught-exceptions-policy=true to handle those exceptions properly.
    (Use `Cursor --trace-deprecation ...` to show where the warning was created)

    Please restart your IDE and try again.

mikey@Mikeys-MacBook-Pro Web Dev % claude -v 1.0.53 (Claude Code)

MikeyZhang75 avatar Jul 17 '25 16:07 MikeyZhang75

Same experiencing the same problem with version 1.0.60

Manual installation does not fix

zanhk avatar Jul 25 '25 18:07 zanhk

Same problem here on VSCode Insiders... no problem on VSCode... echo $TERM_PROGRAM reports vscode for both, but VSCode Insiders does not resolve which code (only which code-insiders).

mrmachine avatar Jul 31 '25 05:07 mrmachine

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 07 '25 14:08 github-actions[bot]