[bug]The Codex extension for VS Code doesn’t use the Node.js version set in the system environment variables.
Open 💬 3 comments Opened Nov 29, 2025 by cheezmil
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of the VS Code extension are you using?
0.5.46
What subscription do you have?
team
Which IDE are you using?
vscode
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What issue are you seeing?
$ powershell.exe -Command 'node start_fe_dev_xdx_toolbox.mjs'
正在设置终端编码为 UTF-8...
终端编码已设置为 UTF-8。
chcp 65001 命令输出: Active code page: 65001
确认 chcp 命令输出: Active code page: 65001
正在以前端开发模式启动项目...
> xdx_toolbox@0.0.0 dev
> chcp 65001 && vite
Active code page: 65001
^[[36mvite v5.4.21 ^[[32mbuilding for development...^[[36m^[[39m
^[[36m
watching for file changes...^[[39m
^[[36mvite v5.4.21 ^[[32mbuilding for development...^[[36m^[[39m
^[[36m
watching for file changes...^[[39m
^[[32m^[[1mVITE^[[22m v5.4.21^[[39m ^[[2mready in ^[[0m^[[1m1053^[[22m^[[2m^[[0m ms^[[22m
^[[32m➜^[[39m ^[[1mLocal^[[22m: ^[[36mhttp://localhost:^[[1m1088^[[22m/^[[39m
^[[2m ^[[32m➜^[[39m ^[[1mNetwork^[[22m^[[2m: use ^[[22m^[[1m--host^[[22m^[[2m to expose^[[22m
^[[36m
build started...^[[39m
^[[36m
build started...^[[39m
transforming...
transforming...
^[[32m✓^[[39m 1 modules transformed.
rendering chunks...
computing gzip size...
^[[2mdist-electron/^[[22m^[[36mpreload.js ^[[39m^[[1m^[[2m2.60 kB^[[22m^[[1m^[[22m^[[2m │ gzip: 0.79 kB^[[22m^[[2m │ map: 4.83 kB^[[22m
^[[36mbuilt in 156ms.^[[39m
^[[32m✓^[[39m 48 modules transformed.
rendering chunks...
computing gzip size...
^[[2mdist-electron/^[[22m^[[36mmain.js ^[[39m^[[1m^[[2m318.68 kB^[[22m^[[1m^[[22m^[[2m │ gzip: 184.36 kB^[[22m^[[2m │ map: 361.88 kB^[[22m
^[[36mbuilt in 682ms.^[[39m
file:///D:/CodeRelated/ElectronProjects/xdx_toolbox/FE/dist-electron/main.js:4
import { ipcMain, globalShortcut, app, BrowserWindow, nativeImage, Menu, Tray, clipboard } from "electron";
^^^^^^^^^^^^^
SyntaxError: The requested module 'electron' does not provide an export named 'BrowserWindow'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:138:5)
Node.js v20.16.0
ERROR: The process "7000" not found.
前端开发进程已退出,退出码 1
The project throws an error because the Codex extension forces the use of a different Node.js version. When I open a new Windows Terminal or run npm run dev in VS Code’s built-in terminal myself, there’s no error at all.
What steps can reproduce the bug?
npm run dev
What is the expected behavior?
_No response_
Additional information
_No response_
3 Comments
When I run the command node -v myself, it shows v20.19.5. But the Codex extension in VS Code insists on using Node.js v20.16.0 to execute JavaScript scripts — that’s incorrect; it should follow the Node.js version that comes with the system. What’s really weird is that when I told Codex to run node -v, it said, "Running node -v shows v20.19.5." That’s totally bizarre!
Closing in favor of #2441.
After some trial and error, I found that it has nothing to do with #2441. The codex has a default variable ELECTRON_RUN_AS_NODE=1. When import { BrowserWindow } from 'electron' is executed, it runs as if it were in a pure Node environment, looking for exports from the npm electron package as ESM, resulting in various strange errors. config: [shell_environment_policy]
inherit = "all"
exclude = ["ELECTRON_RUN_AS_NODE"]
or
then
These can temporarily solve the problem...