Electron: Uncaught ReferenceError: process is not defined

Created on 3 May 2019  路  7Comments  路  Source: electron/electron

Preflight Checklist

  • [x] I have read the Contributing Guidelines for this project.
  • [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • [x] I agree to follow the Code of Conduct that this project adheres to.

Issue Details

  • Electron Version: 5.0.0
  • Operating System: Arch Linux

Expected Behavior


I'd expect to access process object in my renderer process

Actual Behavior


Chrome dev tools throw ReferenceError while accessing to process object.

Uncaught ReferenceError: process is not defined

Most helpful comment

@msudgh nodeIntegration is turned off by default in 5, so you'll need to enable it via:

const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
  webPreferences: {
    nodeIntegration: true
  }
})

which we caution against, or add it via preload script.

All 7 comments

@msudgh nodeIntegration is turned off by default in 5, so you'll need to enable it via:

const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
  webPreferences: {
    nodeIntegration: true
  }
})

which we caution against, or add it via preload script.

@codebytere Thanks. it'd be better to update docs. this functionality existed in previous versions.

@msudgh this information was presented both in release notes and in breaking change documentation leading up to and including the stable release :)

Thanks it worked for me, you don't that how happy now I am thank you very very much...

Thank you very much. Now I can solved my problem!

const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true
}
})

@msudgh nodeIntegration is turned off by default in 5, so you'll need to enable it via:

const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
  webPreferences: {
    nodeIntegration: true
  }
})

which we caution against, or add it via preload script.

Where to add this above code?

@msudgh nodeIntegration is turned off by default in 5, so you'll need to enable it via:

const { BrowserWindow } = require('electron')
let win = new BrowserWindow({
  webPreferences: {
    nodeIntegration: true
  }
})

which we caution against, or add it via preload script.

Where to add this above code?

In your electron apps main.js file, check the project package.json file -- the "main" parameter shows the files path

Was this page helpful?
0 / 5 - 0 ratings

Related issues

feross picture feross  路  3Comments

jviotti picture jviotti  路  3Comments

christiangenco picture christiangenco  路  3Comments

ThorstenHans picture ThorstenHans  路  3Comments

lealife picture lealife  路  3Comments