1

When I use the Remote Extension in vscode, I get a .vscode-server directory. Inside, I can find a node executable, e.g. in ~/.vscode-server/some-random-string/node.

I figured this out by testing the following minimal vscode extension:

import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
 let disposable = vscode.commands.registerCommand('test.helloworld', () => {
 vscode.window.showInformationMessage(process.argv[0]); 
 });
 context.subscriptions.push(disposable);
}
export function deactivate() {}

Running the same extension without the Remote extension, e.g. within Windows, the same extension would show me that I am running vscode from:

C:\Users\username\AppData\Local\Programs\Microsoft VS Code\Code.exe

My question is: is there a node executable available somewhere within vscode (not using Remote Extension) and how to find its path reliably from a vscode extension?

This is what I see in the Microsoft VS Code directory:

Directories:

  • bin
  • locales
  • policies
  • resources
  • tools

as well as the Code.exe, and other irrelevant files. I looked everywhere but couldn't find any node executable.

There is also a ~/.vscode directory in my home folder, where you can find extensions, and an empty cli folder.

asked Dec 7, 2023 at 7:52
1
  • I have no authoritative answer for your question, but I think there's no Node.js. Instead VS Code is based on Electron, which is itself a native binary and provides the necessary APIs for accessing the OS resources like disks, IO and so on. Commented Dec 8, 2023 at 7:49

1 Answer 1

1

It seems the answer is no:

Visual Studio Code has support for the JavaScript and TypeScript languages out-of-the-box as well as Node.js debugging. However, to run a Node.js application, you will need to install the Node.js runtime on your machine.

Note that the node executable in the Remote environment appears to be installed by the vscode server service.

answered Dec 10, 2023 at 6:16
Sign up to request clarification or add additional context in comments.

1 Comment

I wonder why they don't want/aren't able to expose Node by default, given that vscode is based on Electron, and electron apps bundle a node.js executable: electronjs.org/docs/latest/tutorial/tutorial-prerequisites "Electron is a framework for building desktop applications using JavaScript, HTML, and CSS. By embedding Chromium and Node.js into a single binary file, Electron allows you to create cross-platform apps that work on Windows, macOS, and Linux with a single JavaScript codebase."

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.