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

There are two cases to make it work...

  1. As discussed above, install electron globally using -g,

    i.e. using npm install -g electron-packager

  2. Change in your package.json:

   "scripts": {
     "start": "electron-packager ."
   },

Then type in the command npm start.

This way it worked for me..


I might be totally off with it but my fix was that I put the dot without space just make sure in you package.json file its "start": "electron ." Fixed it for me at least


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

Perform a global package install:

npm install -g electron-packager

The -g flag tells NPM to install the package globally which makes the command electron-packager available in your PATH.


If you don't want to do a global install you can install it locally and run with npx.

npm install -D electron-packager 

npx electron-packager .

Alternatively, you can reference it straight from the node_modules folder (not recommended).

./node_modules/electron-packager/cli.js