How i can start new electron project

I created an electron project using this command
npx create-electron-app my-app
and I write some example in YouTube the YouTube example is create the json file using npm init
but when i copy the example code to my project it’s some functionality does not work and if i change the json file with npm init it’s work
so i want to knew what the different between the two method and what’s the best one to create an electron project
I’m still beginner
thanks in advance