You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uncaught ReferenceError: process is not defined #18139
which we caution against, or add it via preload script.
Reacted by Nicolas Bazille, ErgoSphere, makin, Anenth, Sawa, Abdul Al-Hasany, Ali Reza Barkhordari, Sleepy Mouse, Ispirett, Chen-Tai Hou and 68 more
Reacted by M. Arkan Nibrastama, Peter Kota, Alan, Halid Cisse, Jack Bennett and Babajide Mayowa Moibi
Reacted by Peter Kota, Mothana Doubaa, Halid Cisse, Jack Bennett, ZeviLiao and Babajide Mayowa Moibi
Reacted by hashina, Aditya Kresna Permana, Thomas Pham, Sanzhar Danybayev, Christian Haller, M. Arkan Nibrastama, Peter Kota, Omid Nikrah, Mothana Doubaa, Halid Cisse and 2 more
Reacted by M. Arkan Nibrastama, Peter Kota, Mothana Doubaa, Halid Cisse, Jack Bennett and Babajide Mayowa Moibi
Note contextIsolation: false now replaces nodeIntegration: true.
Reacted by Murat Çimen, Alexander, eXhumer, BassOfBass, Carlos Herrera Fumero, ItsJustMiaouss, Zizheng Guo, Cyrille Mescam, 牧星长zolay, gentlecoder and 9 more
Note contextIsolation: false now replaces nodeIntegration: true.
I needed to use both, using only contextIsolation: false / nodeIntegration: true doesn't fix the issue. This affects the quick start guide as only nodeIntegration: true was mentioned there.
Reacted by Jonathan Cantrell, Alex Younger, hondek, Simon Barker, OlegVeselov, BassOfBass, Mike K, Topman, Andrew Heumann, Carlos Herrera Fumero and 32 more
Reacted by roseupam
Reacted by Simon Barker, _, w00zla, Michael Hibbs, Navdeep Singh Rathore, Daemon, Boris, Maoqiang Zheng, roseupam, Victor Ch and 1 more
Reacted by Boris, Maoqiang Zheng, Tomáš Livora, Fred Christensen and roseupam
Reacted by Boris, Maoqiang Zheng and roseupam
Reacted by Hugo St-Onge, w00zla, Daemon and Maoqiang Zheng
Note contextIsolation: false now replaces nodeIntegration: true.
I needed to use both, using only contextIsolation: false / nodeIntegration: true doesn't fix the issue. This affects the quick start guide as only nodeIntegration: true was mentioned there.
THANK YOU SO MUCH! I've been spinning my wheels all day trying to figure out why not even following electron's own quick start guide was working for me!
Reacted by johnnyontheweb, zulmadessire, hbieler, Baha Bilgin, rhllor, Nils-Hero Lindemann, Atul Kumar Jha, Letmeouted, Lajos Sánta, Timo Hausmann and 15 more
Note contextIsolation: false now replaces nodeIntegration: true.
I needed to use both, using only contextIsolation: false / nodeIntegration: true doesn't fix the issue. This affects the quick start guide as only nodeIntegration: true was mentioned there.
thank you so much , i have created so many new project from scratch until i have seen you answer. cheers mate~~
I thought for security purposes, we should disable nodeIntegration and enable contextIsolation... I ran into this issue when I tried to run a packaged Electron app on my other Macbook. Is this safe to run on the main window?
Activity
codebytere commentedon May 3, 2019
@msudgh
nodeIntegrationis turned off by default in5, so you'll need to enable it via:which we caution against, or add it via preload script.
masoudgs commentedon May 3, 2019
@codebytere Thanks. it'd be better to update docs. this functionality existed in previous versions.
codebytere commentedon May 3, 2019
@msudgh this information was presented both in release notes and in breaking change documentation leading up to and including the stable release :)
phamkimtho commentedon Sep 27, 2019
Thank you very much. Now I can solved my problem!
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
})
swapnilvaidankar commentedon Nov 6, 2019
Where to add this above code?
schmorrison commentedon Jan 17, 2020
In your electron apps
main.jsfile, check the projectpackage.jsonfile -- the"main"parameter shows the files pathcawoodm commentedon Dec 27, 2020
Note
contextIsolation: falsenow replacesnodeIntegration: true.raphael10-collab commentedon Feb 11, 2021
@codebytere While keeping nodeIntegration to false how to still access process object?
eXhumer commentedon Mar 3, 2021
I needed to use both, using only
contextIsolation: false/nodeIntegration: truedoesn't fix the issue. This affects the quick start guide as onlynodeIntegration: truewas mentioned there.fortypercenttitanium commentedon Mar 4, 2021
THANK YOU SO MUCH! I've been spinning my wheels all day trying to figure out why not even following electron's own quick start guide was working for me!
ohmygod481999 commentedon Mar 11, 2021
Me too, quick start doesn't work. Uncaught ReferenceError: process is not defined x 3
hbieler commentedon Mar 11, 2021
I found same problem - just by doing the beginners samples.
npm 7.6.2
node v15.11.0
on Windows 20H2
rhllor commentedon Mar 11, 2021
mee too, i follow quickstart but i got "Uncaught ReferenceError: process is not defined".
node v14.16.0
npm v6.14.11
I missing some requirement?
siyavashg commentedon Mar 11, 2021
update your main.js as follows:
hbieler commentedon Mar 11, 2021
Thanks for quick help :-)
this solved the issue in the simple sample ;-)
siyavashg commentedon Mar 12, 2021
nilslindemann commentedon Mar 13, 2021
@codebytere
But it was not, and the latest breaking change (
contextIsolation: false) is not in the official docs.soymikey commentedon Mar 17, 2021
thank you so much , i have created so many new project from scratch until i have seen you answer. cheers mate~~
visionari-labs commentedon Apr 25, 2021
I thought for security purposes, we should disable nodeIntegration and enable contextIsolation... I ran into this issue when I tried to run a packaged Electron app on my other Macbook. Is this safe to run on the main window?
arnoldmartinez commentedon Mar 5, 2022
I did resolve it putting contextIsolation to false.
// 1. import electron objects
const { app, BrowserWindow } = require('electron');
// 2. reserve a reference to window object
let window;
// 3. wait till application started
app.on('ready', () => {
// 4. create a new window
window = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
// 5. load window content
window.loadFile('index.html');
});
m4xlmum commentedon Apr 8, 2022
It done, Thanks. From Electron v18.0.1
ndkk commentedon Jun 24, 2022
The key:
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
Thanks !
"I am using Node.js 16.14.2, Chromium 102.0.5005.63, and Electron 19.0.4“
IshmeetSingh06 commentedon Oct 20, 2022
If i use both of the nodeIntegration:true and constextIsolation:false it shows up a error which is:

If i turn both of them true it still get the error: process is not defined