require('SOLVED'); [Electron Quick Start Issue] TypeError: Cannot read property 'on' of undefined | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

require('SOLVED'); [Electron Quick Start Issue] TypeError: Cannot read property 'on' of undefined

I was following Writing Your First Electron App https://electronjs.org/docs/tutorial/first-app I got the error as titled. I searched and a solution is found at https://github.com/electron/electron-quick_start/issues/107 Replace script with "scripts" :{"test" :"electron . ", "start" :"electron . "} I edited package.JSON accordingly, but the error is still there 👉👈

8th Apr 2019, 4:13 AM
Gordon
Gordon - avatar
32 Answers
+ 3
Try to run npm install --save-dev electron again Make sure cmd run as administrator
8th Apr 2019, 8:14 AM
Calviղ
Calviղ - avatar
+ 3
You can set path environment variables. Node sets itself during setup. You can exec command "node" in any location (globally)
8th Apr 2019, 10:30 AM
Вап
+ 3
After unzipping cmder mini Popup: Warning! ConEmu binaries were marked as 'Downloaded from internet' : This may cause blocking or access denied errors! 🤔 Firewall?
10th Apr 2019, 3:58 AM
Вап
+ 3
Gordon Did you solve your problem?
10th Apr 2019, 7:18 AM
Вап
+ 2
2 steps npm i is same as npm install sharthand
8th Apr 2019, 10:16 AM
Calviղ
Calviղ - avatar
+ 2
Better way to use windows command prompt, download cmder.net tool https://cmder.net I dont use windows command prompt, too lousy. I use cmder, very best tool. OR you could use VS Code terminal, no need to leave your editor, very convenient.
8th Apr 2019, 11:08 AM
Calviղ
Calviղ - avatar
+ 2
Oh I fixed three typos and now it is working ~
10th Apr 2019, 4:20 AM
Gordon
Gordon - avatar
+ 2
Gordon So you had 3 typos. And they were purposes of errors?
10th Apr 2019, 4:48 AM
Вап
+ 2
Calvin solved my problem I followed his install command with --save-dev and his command prompt application
10th Apr 2019, 9:25 AM
Gordon
Gordon - avatar
+ 1
So the steps are: nvm use 10.11.0 npm i -D electron@latest npm install --save-dev electron Three steps?
8th Apr 2019, 10:03 AM
Gordon
Gordon - avatar
+ 1
I am using the cmd of Node, am I right? And when I choose run as administrator, I find that the starting directory is System32 instead of Users, so I just start to input the commands at System32? Or I should switch back to the folder created for Node projects?
8th Apr 2019, 10:17 AM
Gordon
Gordon - avatar
+ 1
I always run cmd from working project folder..
8th Apr 2019, 10:27 AM
Calviղ
Calviղ - avatar
+ 1
After in Node.js command prompt nvm use 10.11.0 It said 'nvm' 不是內部或外部命令、可執行的程式或批次檔。 🤔
8th Apr 2019, 10:33 AM
Gordon
Gordon - avatar
+ 1
You mean no need to change Node version?
8th Apr 2019, 10:34 AM
Gordon
Gordon - avatar
+ 1
Should run from normal command prompt at working folder.
8th Apr 2019, 10:36 AM
Calviղ
Calviղ - avatar
+ 1
Go to windows find Type "cmd" Select "Command Prompt" cd <change to working folder> continue with your commands
8th Apr 2019, 10:44 AM
Calviղ
Calviղ - avatar
+ 1
I see what you mean by Nodejs comand now DONT USE nodejs command line for any npm and other installations... Node command line just a repl for node script testing only. When we say command prompt cmd, it should be windows command prompt.
8th Apr 2019, 10:56 AM
Calviղ
Calviղ - avatar
+ 1
VS Code Terminal is referring to "Package Manager Console" at bottom of middle of VS interface?
10th Apr 2019, 3:44 AM
Gordon
Gordon - avatar
+ 1
cmder download mini or download full?
10th Apr 2019, 3:47 AM
Gordon
Gordon - avatar
+ 1
After unzipping cmder mini Popup: Warning! ConEmu binaries were marked as 'Downloaded from internet' : This may cause blocking or access denied errors! 🤔
10th Apr 2019, 3:53 AM
Gordon
Gordon - avatar