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

后端 未结 6 1516
臣服心动
臣服心动 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:21

    In my case it doesn't worked after npm global installation.

    On the electron-builder Readme page it's recommended to install with yarn.

    Yarn is strongly recommended instead of npm.
    yarn add electron-builder --dev
    

    Also we can put folder directly to PATH. On Windows 10:

    1. Search with word "environment" and open Edit the environment variables.
    2. Select, edit and Add new value C:\Users\USER_NAME\AppData\Roaming\npm to variable Path. Replace USER_NAME with your Windows username.

    Then we might need to restart or logout.

    Also in my case I enabled script execution on Windows 10 with instruction on answer below:

    PowerShell says "execution of scripts is disabled on this system."

提交回复
热议问题