electron: [Bug]: Electron sandbox_bundle.js script failed to run
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
16.0.4
What operating system are you using?
Windows
Operating System Version
Windows 11 v. 10.0.22000
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
NOW(State)
- I can’t start
electronbecause it will quit after the window created for about 2 seconds.- I can’t load the page successfully, But it is not a problem for electron.
The first, I used electron-reloader to reload the page.
[1209/065626.727:ERROR:registration_protocol_win.cc(106)] CreateFile: 系统找不到指定的文件。 (0x2)
[1209/065626.743:ERROR:registration_protocol_win.cc(106)] CreateFile: 系统找不到指定的文件。 (0x2)
[13616:1209/065627.256:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160)
[13616:1209/065627.257:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160)
Here is my window configuration
{
width: Math.floor((width * 2) / 3),
height: Math.floor((height * 2) / 3),
frame: false,
webPreferences: {
contextIsolation: false,
sandbox: false,
preload: resolve(__dirname, <string>process.env.PRELOAD_PLACE),
},
}
and the value of process.env.PRELOAD_PLACE is preload.js in development.
This is my preload.ts, which is going to compile to be preload.js with esbuild
import { ipcRenderer } from 'electron'
window.ipcRenderer = ipcRenderer
Actual Behavior
Start Electron Successfully.
Testcase Gist URL
No response
Additional Information
Project Source: stunning-new
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 27
- Comments: 80 (8 by maintainers)
For me the message only appears when I install the REACT_DEVELOPER_TOOLS extension with electron-devtools-installer and try to open the devtools.
Hello from 2023 with electron@23.0.0 👋
I’ve just upgraded electron from version 11 to version 17 and now have this same error.
[1] [26800:0202/155118.507:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160) [1] [26800:0202/155118.507:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160)Same for me, testing it on electron
18.2.0this error only shows up whenelectron-devtools-installeris used.Hello from electron 25.0.1 ! any updates ?
Bump
Im using electron
18.2.0withoutelectron-devtools-installerand I still get this error.This is how Im loading the extension:
app.whenReady().then(async () => {createWindow()await session.defaultSession.loadExtension(reactDevToolsPath)})bump
I’m facing the same error but when trying to install VUEJS3_DEVTOOLS.
Then if I try to access VueJS dev tools in the browser window, it freezes and won’t let me do anything.
Confirm: Electron
18.0.1also show those warningHi, I maintain
electron-devtools-installer, a new version was released only a few weeks ago…This issue is actually a non-issue, it’s just an error log that happens when a the background page starts up for a devtools extension, it doesn’t actually impact the running of that extension afaik.
In my case, i found it is the plugin
electron-devtools-installercause the error.Those codes runs before
new BrowserWindow(xxxx)Indeed, still present in Electron 22.x
Hey everyone I just wanted to let you know that we have been sharing this issue for such a long time, that I really got to like you all. So I just wanted to let you know I am getting married next April and I fear our children will still suffer in a world plagued by “Electron sandbox_bundle.js script failed to run”!
How is life for you?
bump
bump, same issue with last version of electron
I get the same in 18.0.4 on macOS, however this appears in the console only after opening the DevTools. With DevTools closed, the “error” does not appear.
However, it’s just a message in the console for me. Everything works otherwise.
I’m not using
webPrefences.sandboxbut I am still getting the same error. I am using electron v17[4616:0206/230146.903:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160) [4616:0206/230146.914:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160) [20996:0206/230338.183:ERROR:gpu_init.cc(454)] Passthrough is not supported, GL is disabled, ANGLE is@7086cmd I am getting the same issue with
contextIsolation: true.Just chiming in to say, I just ran into this issue on 33.2.0, and in my case I don’t have
electron-devtools-installer, but deleting the cache did fix the issue. (thank you @artus9033 !)I’m on mac os and the cache is in
/Users/<user>/Library/Application Support/<yourAppName>/Cache(windows and linux). I nuked both Cache and Code Cache, not knowing what Code Cache does but finding the name made it relevant 😄Hello guys, I’ve also been struggling with this issue for a long time. For me what helped was - similarly to what @MarshallOfSound described - upgrading
electron-devtools-installerBUT additionally removing the electron app cache.I haven’t had time to confirm this for sure, but I assume this is because the faulty files that were actually causing the issue were likely placed in the app’s cache directory, making ‘just the upgrade’ not enough to fix the problem. On a machine that had earlier used the faulty version of devtools installer - which apparently caused the problem described - the problem would still occur exactly because of this cache. After a pretty long time my app has not been working just on one device (I kept thinking it was a matter of the OS rather than the specific device), now it’s running just fine.
For reference, the path where the cache to be deleted is kept, differs on each OS and you can find it here: https://stackoverflow.com/a/44675132
I can confirm that I don’t get the error on 17.1.0 but do on other versions, including the latest (18.0.1)
It’s funny, when I’m using version 17.2.0, I will get such warning. But this warning gone when I use 17.1.0 instead, without any other change. I have confirmed several times that the difference is caused by version.
@akaushal123 Could you give 17.1.0 a try?
front end is no use for solving this problem(((
I’ve just upgraded npm as I noticed your version is newer but it made no difference.
MINGW64 /c/git/electron-sandbox-error-repo (master) $ npm start
[0] yarn run v1.22.17 [0] $ react-scripts start [0] (node:8552) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: ‘onAfterSetupMiddleware’ option is deprecated. Please use the ‘setupMiddlewares’ option. [0] (Use
node --trace-deprecation ...to show where the warning was created) [0] (node:8552) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: ‘onBeforeSetupMiddleware’ option is deprecated. Please use the ‘setupMiddlewares’ option. [0] Starting the development server… [0] [0] Compiled successfully! [0] [0] You can now view electron-sandbox-error in the browser. [0] [0] Local: http://localhost:3000 [0] On Your Network: http://192.168.10.47:3000 [0] [0] Note that the development build is not optimized. [0] To create a production build, use npm run build. [0] [0] asset static/js/bundle.js 1.43 MiB [emitted] (name: main) 1 related asset [0] asset index.html 2.18 KiB [emitted] [0] asset asset-manifest.json 190 bytes [emitted] [0] runtime modules 28.2 KiB 13 modules [0] modules by path ./node_modules/ 1.33 MiB [0] modules by path ./node_modules/core-js-pure/ 24.8 KiB 53 modules [0] modules by path ./node_modules/webpack-dev-server/client/ 62.1 KiB 12 modules [0] modules by path ./node_modules/webpack/hot/.js 4.4 KiB 4 modules [0] modules by path ./node_modules/react/ 119 KiB 4 modules [0] modules by path ./node_modules/html-entities/lib/.js 115 KiB 4 modules [0] modules by path ./node_modules/scheduler/ 29.4 KiB 4 modules [0] modules by path ./node_modules/@pmmmwh/react-refresh-webpack-plugin/ 9.01 KiB 2 modules [0] modules by path ./node_modules/react-refresh/ 24.1 KiB 2 modules [0] modules by path ./node_modules/react-dom/ 959 KiB 2 modules [0] + 3 modules [0] modules by path ./src/ 3.87 KiB [0] ./src/index.js 1.36 KiB [built] [code generated] [0] ./src/components/App.js 2.51 KiB [built] [code generated] [0] webpack 5.68.0 compiled successfully in 5313 ms [1] [1] app.whenReady [1] [13904:0204/085311.165:ERROR:CONSOLE(160)] “Electron sandbox_bundle.js script failed to run”, source: node:electron/js2c/sandbox_bundle (160) [1] [13904:0204/085311.165:ERROR:CONSOLE(160)] “TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))”, source: node:electron/js2c/sandbox_bundle (160)I’ve also updated react-scripts.
Btw,
contextIsolationistrueby default.