简体   繁体   中英

Electron: project fails at start script

Well, I've scoured the internet for an answer, but I haven't found a definitive one that works.

It's gotten to the point of downloading the example from Electron's website and taking the scripts and putting them straight into my project. Here is the error that I get when launching it from my project (although it works fine with Electron's example repository):

electron . 
sh: electron: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! Obfus@1.0.0 start: electron .
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the Obfus@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I've updated npm and Electron to ensure that they're up to date, but it still fails constantly. Any suggestions? Thanks so much! (Also, if you'd like to see what the console says, please tell me - I found it a bit too long to be put in a question like this.)

You need to install Electron globally like so

npm install -g electron

Do you get the same error message if you install and run right after each other in the same terminal?

npm install -g electron
electron .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM