Running the "First Electron App" wont show versions?

running the game song
running in the usa
running the gauntlet
running the game meaning
running the 50 states
running in the usa 10k
running events in 2019
running races

I am following the Electron quick start guide, it works without any errors, but the output is not as described in the docs, the versions with document.write wont show up in the output.

This is my output:

Hello World!

We are using node , Chrome , and Electron .

My expected output would include the corresponding version numbers.

I have checked the GitHub page of the app, still the same, tried various StackOverflow answers but none worked for me.

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node) </script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron) </script>.
</body>
</html>

package.json

{
    "name": "electronapp",
    "version": "1.0.0",
    "description": "",
    "main": "main.js",
    "scripts": {
       "start": "electron ."
    },
    "author": "harsh",
    "license": "ISC",
    "devDependencies": {
        "electron": "^5.0.2"
    }
}

main.js

const {app, BrowserWindow} = require('electron')
const path = require('path')
let mainWindow

function createWindow () {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            preload: path.join(__dirname, 'preload.js')
        }
    })

    mainWindow.loadFile('index.html')
    mainWindow.on('closed', function () {
        mainWindow = null
    })
}

app.on('ready', createWindow)

app.on('window-all-closed', function () {
    if (process.platform !== 'darwin')
        app.quit()
})

app.on('activate', function () {
    if (mainWindow === null)
        createWindow()
})

I have Node globally installed, and Chrome is packaged with Electron, right?

If you activate the Developer Tools, you should see error messages in the Console like such:

Uncaught ReferenceError: process is not defined
    at index.html:11

You need to activate nodeIntegration of the BrowserWindow, so that the process running in the BrowserWindow ("renderer process") is allowed to access Node's process object.

mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
        nodeIntegration: true
    }
})

Running in the USA, Who is running the city of Vergennes? We're asking because more than half of the political leaders in that small city have stepped down. Running is a method of terrestrial locomotion allowing humans and other animals to move rapidly on foot. Running is a type of gait characterized by an aerial phase in which all feet are above the ground (though there are exceptions).

This is your file with correction

const {app, BrowserWindow} = require('electron')
const path = require('path')
let mainWindow
function createWindow () {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            // I think you don't need this line
            // preload: path.join(__dirname, 'preload.js') 
            nodeIntegration: true
        }
    })
    mainWindow.loadFile('index.html')
    mainWindow.on('closed', function () {
        mainWindow = null
    })
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
    if (process.platform !== 'darwin') app.quit()
})
app.on('activate', function () {
    if (mainWindow === null) createWindow()
})

Who is running the city of Vergennes?, Starting the Notebook Server�. After you have installed the Jupyter Notebook on your computer, you are ready to run the notebook server. You can start the� Running definition is - the action of running. How to use running in a sentence.

You most change your code like this

const { app, BrowserWindow, process } = require('electron')

Running the gauntlet, Amazon.com: Running the World: The Inside Story of the National Security Council and the Architects of American Power (9781586484231): Rothkopf, David:� Running tips for every type of runner and location.

Running the Notebook — Jupyter Documentation 4.1.1 alpha , What I Talk About When I Talk About Running: A Memoir (Vintage International), Book Cover May Vary [Murakami, Haruki] on Amazon.com. *FREE* shipping on� Running definition, the act of a person, animal, or thing that runs. See more.

Running the World: The Inside Story of the National , Getting started with running can feel overwhelming to a beginner runner. Here are some of the basics of running to help you get started. Song Runnin' (Lose It All) Artist Naughty Boy; Writers Beyoncé, Dean Carlos McIntosh, Carla Marie, Shahid Khan, Jonny Coffer; Licensed to YouTube by

What I Talk About When I Talk About Running: A Memoir (Vintage , You'll love our virtual races! Virtually run, walk, bike, swim, exercise while making fit fun! Get your Run The Year, Amerithon Challenge, Streaker Series, Hug A� See what's happening with Nike Running. Check out the latest innovations, top performance styles and featured stories. Nike processes information about your visit using cookies to improve site performance, facilitate social media sharing and offer advertising tailored to your interests.

Comments
  • Did you installed the dependencies?
  • Check my edit, i am not sure i answer your question.
  • Please, if you can, add your main.js and some screenshot of the output.
  • I have added the main.js file and the link to screenshot as you asked for.
  • Thanks a ton! I am just getting started with electron and couldnt figure this out, also how do i activate developer tools?
  • If you have the default application menu, you can do it there. Or in code: mainWindow.toggleDevTools().
  • So the uncaught reference error, would have shown up without your answer edit?
  • No. Sorry about the confusion. The error results from your original code (when nodeIntegration is not enabled). I included this in the answer to indicate how to catch similar issues. I moved this part up to make the order more logical.
  • This solves the issue, but I already accepted the answer by above user. As pointed out by you, what does that line do anyway? I dont have a file like that anyway. Does it do some preloading for the app, and can it be used by me to do any useful stuff in for the app?
  • Quote of Official doc preload String (optional) - Specifies a script that will be loaded before other scripts run in the page. This script will always have access to node APIs no matter whether node integration is turned on or off. The value should be the absolute file path to the script. When node integration is turned off, the preload script can reintroduce Node global symbols back to the global scope.