ipcMain not defined when electron installed locally on linux


My app was able to run on mac (electron installed globally on mac). When I ran it on Linux (installed locally), it kept saying it could not execute ‘on’ on undefined which referred to ipcMain.

I installed my electron locally using npm install electron-prebuilt without the g flag on linux. I’ve tried:
const ipcMain = require(‘electron’).ipcMain;
as well as
const ipcMain = require(‘ipc-main’)

first one gives me undefined and the second one says that ipc-main module cannot be found.
Any ideas?