If you want to get fancy, this is the closest to The Right Way I've seen Electron apps built (and it's how I package them for Arch):
# Remove postinstall script that rebuilds for Electron
# Instead we just build correctly the first time
sed -i '/postinstall/d' package.json
# Native Electron's version from your package manager).
export npm_config_target=$(electron4 -v)
# The architecture of Electron, can be ia32 or x64.
export npm_config_arch=x64
export npm_config_target_arch=x64
# Download headers for Electron.
export npm_config_disturl=https://atom.io/download/electron
# Tell node-pre-gyp that we are building for Electron.
export npm_config_runtime=electron
# Install all dependencies, and store cache to ~/.electron-gyp.
HOME=~/.electron-gyp npm install --only=production