點(diǎn)擊打開Git Graph時(shí)報(bào)錯(cuò):Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state
解決方法:關(guān)閉vscode,在cmd中輸入命令
code --no-sandbox
code --no-sandbox 命令是用于在沒(méi)有沙箱模式的情況下打開 Visual Studio Code 編輯器。沙箱模式是一種安全措施,用于限制代碼的權(quán)限和對(duì)系統(tǒng)資源的訪問(wèn)。
然而,需要注意的是,從 Visual Studio Code 1.35 版本開始,沙箱模式已經(jīng)不再是可選的,而是默認(rèn)啟用的。這意味著,如果你正在使用的是 Visual Studio Code 1.35 或更高版本,你不能通過(guò) --no-sandbox 命令關(guān)閉沙箱模式。
如果你需要在開發(fā)過(guò)程中以非沙箱模式運(yùn)行某些代碼,你可能需要考慮在 Visual Studio Code 的設(shè)置中調(diào)整或禁用相關(guān)的安全限制,或者在不同的權(quán)限較低的用戶賬戶中運(yùn)行 Visual Studio Code。
如果你是在尋找如何在命令行中啟動(dòng) Visual Studio Code,并且你正在使用的是較舊版本的 Visual Studio Code,那么 code --no-sandbox 命令可能是用來(lái)啟動(dòng) Visual Studio Code 而不使用沙箱模式的。