在electron.js中,npm启动命令不起作用。它说电子不被识别为内部或外部命令

时间:2019-04-27 07:17:40

标签: node.js electron electron-packager

operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

2 个答案:

答案 0 :(得分:0)

似乎尚未安装电子。为了运行electron命令,您需要正确安装并配置node和npm,然后运行。

npm i -g electron

答案 1 :(得分:0)

我几乎尝试了所有事情,但最终我能够解决它。

“ electron-webpack-quick-start”为我们设置了所有内容,我们无需担心安装pacakges的问题,只需运行命令即可,很有趣 它对我有用。

  1. mkdir new-electron-webpack-project
  2. cd new-electron-webpack-project

    3.curl -fsSL https://github.com/electron-userland/electron-webpack-quick-start/archive/master.tar.gz | tar -xz --strip-components 1

  3. git clone https://github.com/electron-userland/electron-webpack-quick-start.git

5.cd electronic-webpack-quick-start

  1. rm -rf .git

  2. 纱线

8.yarn开发

有关更多信息,请阅读下面的链接 https://github.com/electron-userland/electron-webpack-quick-start