简体   繁体   English

电子:项目在启动脚本时失败

[英]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. 到了从Electron网站上下载示例并获取脚本并将其直接放入我的项目的地步。 Here is the error that I get when launching it from my project (although it works fine with Electron's example repository): 这是我从项目启动它时遇到的错误(尽管它在Electron的示例存储库中可以正常工作):

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. 我已经更新了npmElectron以确保它们是最新的,但仍然会不断失败。 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 您需要像这样全局安装Electron

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 .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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