首页 > 解决方案 > 运行电子应用程序时出现错误时我能做什么

问题描述

我通过 electronjs 文档制作了我的第一个电子应用程序。我使用命令运行了应用程序npm start,但这向我显示了这个错误

$ npm 开始

my-electron-app@1.0.0 启动 C:\Users\aksha\OneDrive\Desktop\ElcDocStarter\my-electron-app electron 。

'electron' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-electron-app@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-electron-app@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aksha\AppData\Roaming\npm-cache\_logs\2021-02-17T08_15_08_284Z-debug.log

标签: node.jsnpmelectron

解决方案


安装electron为全局 NPM 模块:

npm i -g electron

推荐阅读