'electron-packager' is not recognized as an internal or external command

后端 未结 6 1514
臣服心动
臣服心动 2021-02-05 16:43

I recently started using electron. I have successfully completed the 1st phase by creating a hello world app (included files index.html, main.js, package.json). Now I am trying

6条回答
  •  旧巷少年郎
    2021-02-05 17:20

    If you have installed it locally with:

    npm install electron-packager
    

    Then, it's not gonna work, install it globally as a cli:

    npm install -g electron-packager
    

    You can also get it through:

    "node_modules/electron-packager/cli.js" . --all --asar
    

    After All, if you don't get it working, install electron-packager. Then, go to your package.json. And beneath your start scripts. Make another string named "build" and give it a value of the electron-packager command you want to run:

    ...
        "scripts": {
        "start": "electron .",
        "build": "electron-packager . --asar --all"
      },
    ...
    

    Then, go in command prompt or terminal or bash. Then, type:

    npm run build
    

提交回复
热议问题