Skip to content

Does VM2 support proxy? #544

@shengzengyang

Description

@shengzengyang

`PS D:\PythonProject\补环境> ${env:NODE_ENV}='development'; ${env:NODE_OPTIONS}=' --require c:/Users/11373/.vscode/extensions/ms-vscode.js-debug-nightly-2025.10.117/src/bootloader.js --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}=':::{"inspectorIpc":"\\.\pipe\node-cdp.4244-633c02d8-1.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\Program Files\nodejs\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\Users\11373\AppData\Local\Temp\node-debug-callback-02ac0a81d1df97da"}'; & 'C:\Program Files\nodejs\node.exe' '.\src\index.js'
Debugger attached.

D:\PythonProject\补环境\node_modules\vm2\lib\vm.js:291
throw bridge.from(e);
^
Waiting for the debugger to disconnect...
TypeError: Proxy is not a constructor
at vm.js:17:25
at v (vm.js:42:14)
at S (vm.js:67:21)
at vm.js:91:13
at vm.js:658:2
at Script.runInContext (node:vm:149:12)
at VM.runScript (D:\PythonProject\补环境\node_modules\vm2\lib\vm.js:289:18)
at VM.run (D:\PythonProject\补环境\node_modules\vm2\lib\vm.js:509:16)
at Object. (D:\PythonProject\补环境\src\index.js:18:4)
at Module._compile (node:internal/modules/cjs/loader:1760:14)

Node.js v24.11.0`
I created a sandbox using VM2 to run my JS code, and there is a new proxy in the code. When I called the main function to run the code, I encountered this error. I asked Chattpt and he told me that VM2 does not support proxies. I would like to inquire if this is true and if there is any good solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions