I am trying to learn how to build an electron app, so I decided to try making the quickstart project found on the official website here.
However, I quickly ran into problems because I keep getting errors, and I cannot even begin to build the app because electron won’t run.
I downloaded the latest LTS version of Node.js, and then I ran the following commands in the terminal:
npm init -y
npm i --save-dev electron
touch main.js
I did not modify the main.js file, so it is blank.
I then changed the default scripts in package.json into:
"start": "electron ."
After this, I then ran npm start
, but it gave me the following error:
dyld: Library not loaded: /System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers
and it also said Reason: image not found
I tried deleting all the files and restarting from scratch, thinking that I might have made a mistake somewhere.
I tried putting in console.log("Hello World")
in the main.js file, and then running npm start
again.
I tried shutting down my computer and turning it on again.
None of these things worked.
I also tried to run electron .
directly in the command line, and that’s when I got the error zsh: command not found: electron
.
I also tried starting over again and making electron a dependency instead of dev dependency, but I still got all the same errors.
I tried googling different keywords and phrases from the errors I received, but I could not find anything that I could try to use as a possible solution.
The only way I could get my main.js to run was if I put node main.js
in the command line, and it properly logged Hello World in the terminal.
I’m not sure if it is relevant, but for reference I am using a 2019 16-inch Macbook Pro on macOS Catalina 10.15.7.
If there is already a similar case out there, I apologize that I couldn’t find it due to my lack of experience. I am an absolute beginner in electron and I’m just starting to figure things out. I would appreciate any help on this. Thank you.