iocave / monkey-patch

Inject custom javascript into vscode
MIT License
154 stars 17 forks source link

Monkey patch corrupts the vscode 1.63.0 -- cannot open any file #30

Closed rbadapanda closed 2 years ago

rbadapanda commented 2 years ago

I am not able to open any file.

error I am getting for every file is:

Unable to open 'blah.md': Cannot find module 'jschardet' Require stack: - electron/js2c/renderer_init.

VS Code version: Code - Insiders 1.63.0-insider (4e303fc, 2021-11-22T05:26:03.776Z) OS version: Darwin x64 21.1.0 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|4, 4, 4| |Memory (System)|16.00GB (0.02GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
knopp commented 2 years ago

Can't seem to reproduce this even with latest insiders. Does this persist when you redownload vscode insiders and reapply monkey patch?

rbadapanda commented 2 years ago

Yes, I see the repro even after I re-downloaded the insiders. However with the current VS-Code (not, insiders) it works fine. I am using customize-ui extension. Did you try it on MacOS Monterey ? Just want to confirm. (though it should not matter, mostly)

SolarTheory commented 2 years ago

I am having exactly the same issue as the OP after I just upgraded to v.1.63.0. I am also using the Customize-UI extension. I can't open any file. Any existing editors when workspace is launched cannot open, and attempting to create a new editor also generates errors.

In the body of the editor: "The editor could not be opened due to an unexpected error".

Toast notification:
"Unable to open 'Untitled-1': Cannot find module 'jschardet' Require stack:

Reinstalling VS Code Insiders and NOT applying the Monkey Patch is the only way to fix it. The command "Disable Monkey Patch" did not work for me. Also, running Insiders with all extensions disabled still resulted in errors.

VS Code Version: 1.63.0-insider (system setup) Commit: 68a1e2f872f8869b004eec284917782474730e0b Date: 2021-12-02T05:15:40.605Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19043

CPUs | Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 x 1498) -- | -- GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled Load (avg) |   Memory (System) | 15.69GB (0.24GB free) Process Argv | Screen Reader | no VM | 0%
knopp commented 2 years ago

There must be something else going on here. I have 1.63.0-insiders (from today), based on Electron 13.5.2, but I can not reproduce this.

rbadapanda commented 2 years ago

Here is the stack trace. I found it in Output > Log(Window) dropdown

Require stack:
- electron/js2c/renderer_init
    at Module._resolveFilename (internal/modules/cjs/loader.js:934:15)
    at Function.t._resolveFilename (electron/js2c/renderer_init.js:45:859)
    at Module._load (internal/modules/cjs/loader.js:779:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Function.t._load (electron/js2c/renderer_init.js:45:307)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at r (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:101)
    at e.load (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:3:11528)
    at e.load (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:3:10695)
    at d (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:10300)
    at Object.errorback (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:10421)
    at e.triggerErrorback (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:3:11059)
    at vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:3:10765
    at e.load (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:3:11545)
    at e.load (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:3:10695)
    at d (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:10300)
    at i._loadModule (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:10430)
    at i._resolve (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:6:452)
    at i.defineModule (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:6142)
    at i._relativeRequire (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:6828)
    at r (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js:5:9406)
    at f (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:3252)
    at new Promise (<anonymous>)
    at s (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:3232)
    at r (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:4354)
    at M (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:1487)
    at Object.onEnd (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:1937)
    at vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:57920
    at vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:56147
    at Array.forEach (<anonymous>)
    at I.emitEnd (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:56136)
    at I.flowEnd (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:57048)
    at I.resume (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:55413)
    at I.on (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:56239)
    at v (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:69:57931)
    at vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:1756
    at new Promise (<anonymous>)
    at y (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1726:1368)
    at u.doGetDecodedStream (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2369:43429)
    at u.doRead (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2369:42376)
    at async u.readStream (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2369:42035)
    at async sn.resolveFromFile (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2358:73209)
    at async o.doResolve (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2369:36878)
    at async Oa.doResolveAsText (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1741:85703)
    at async Promise.all (index 0)
    at async Yr.createModel (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1523:9854)
    at async Yr.resolve (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1523:9569)
    at async el.setInput (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2323:41867)
    at async n.doSetInput (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2323:35224)
    at async n.doOpenEditor (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2323:33525)
    at async n.openEditor (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2323:33151)
    at async vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2525:17056
septsea commented 2 years ago

I encountered the issue approximately two weeks ago, too. However, I could not reproduce the issue... (So I did not say anything.)

I updated VS Code Stable this morning, and the same error occurred (as is expected).

"Reinstalling VS Code Insiders and NOT applying the Monkey Patch is the only way to fix it." The same here.


Update in the morning on the tenth of December:

The issue remains in the latest insider build (as is expected). It is still there.

Version: 1.64.0-insider (user setup)
Commit: 10791447894a9abc9f2ae4927bf92bcf30f3fdef
Date: 2021-12-09T21:26:02.543Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22518

However, I cannot reproduce the issue on PCs other than my own PC (as is expected, again). Why am I unable to reproduce the issue?

Version: 1.64.0-insider (user setup)
Commit: 10791447894a9abc9f2ae4927bf92bcf30f3fdef
Date: 2021-12-09T21:26:02.543Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22518

Maybe there is something else that causes the issue.

zoltankundi commented 2 years ago

I have the same issue on regular VS Code Version: 1.63.0 Commit: 7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e Date: 2021-12-07T05:16:45.441Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Linux x64 5.4.0-91-generic

knopp commented 2 years ago
Screen Shot 2021-12-09 at 10 04 52 PM

With same version - no issues at all. There must be some other factor here contributing to this :-/

Terafugia commented 2 years ago

First time running Code after upgrading to Windows 11 and got the same problem. I tried disabling Monkey Patch and Customize UI. Didn't make any difference.

wSedlacek commented 2 years ago

Got this error after the VS Code update today

Screen Shot 2021-12-09 at 20 52 41 Screen Shot 2021-12-09 at 20 54 09
cubeweb commented 2 years ago

I have the same issue on mac Unable to open file: Cannot find module 'jschardet' Require stack: - electron/js2c/renderer_init.

Version: 1.63.0 (Universal) Commit: 7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e Date: 2021-12-07T05:15:48.091Z (3 days ago) Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Darwin x64 21.1.0

Traumatism commented 2 years ago

worked for me (didn't patched it, but able to remove it without needing to reinstall vs-code, references of the files: locate monkey, locate customize)

rm "/Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js.monkey-patch.backup"

rm "/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench-monkey-patch.html"

rm -rf "/Users/$(whoami)/.vscode/extensions/iocave.customize-ui-0.1.55"

rm -rf "/Users/$(whoami)/.vscode/extensions/iocave.monkey-patch-0.1.15"

wSedlacek commented 2 years ago

I was able to remove it too just by using the Disable Patch option in the command palette then restarting VS Code.

machinemessiah commented 2 years ago

Just chiming in to report the same Unable to open file: Cannot find module 'jschardet' Require stack: - electron/js2c/renderer_init. error. Tried a few things, deleting cache folders etc, to no avail. Reinstalling VScode gets me back to normality, but obviously I can't apply Monkey Patch afterwards without running into the same error message...

Version: 1.63.0 (user setup) Commit: 7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e Date: 2021-12-07T06:26:56.179Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042

Does anyone have it working on 1.63.0?

knopp commented 2 years ago

I finally managed to reproduce the problem. I get the error when I trying to choose the encoding for the file. I'm looking into this.

knopp commented 2 years ago

Can you guys retest this with once monkeypatch 0.1.16 is online?

septsea commented 2 years ago

@knopp Nothing seems wrong anymore. It also works normally in 1.64.0.

ehlxr commented 2 years ago

Can you guys retest this with once monkeypatch 0.1.16 is online?

it works 👍👍

wSedlacek commented 2 years ago

Can you guys retest this with once monkeypatch 0.1.16 is online?

Confirmed working again after this patch. Thank you!

rbadapanda commented 2 years ago

Works for me (tested with monkeypatch 0.1.16).

Thanks for fixing it.