electron-packager is not recognized as a cmdlet name (Windows)

Created on 5 Feb 2017  路  19Comments  路  Source: electron/electron-packager

I installed electron-packager, but I can not use it:

The term 'electron-packager' is not recognized as a cmdlet name......
windows question

Most helpful comment

Install electron and electron-packager globally:

npm install -g electron electron-packager

This will install electron 1.4.15 and electron-packager 8.5.1 into your user folder, not in project folder:

C:\Users\Administrador\AppData\Roaming\npm

or it can be some Documents and Settings, anyway you dont have to bother about this folder and touch anything there.

Delete if present node_modules folder in your project folder.
go in cmd. exe to your project folder:

electron-packager . --all --electron-version=1.4.15

Dont use PS, use cmd.exe

All 19 comments

Thanks for filing an issue! In order to help you with your problem, we're going to need more information about it. In particular:

  • What version of Windows are you using? Which architecture is it? (32-bit, 64-bit, ARM?)
  • How did you install Electron Packager?
  • How are you trying to run Electron Packager? Assuming you're using a console, which console program are you using? cmd.exe? powershell? cygwin? Something else? (I'm mostly confused as to what a cmdlet is.)

I use WIndows 7 Ultimate, x64 version
I installed using "npm install electron-packager -g"
I've tried using:
"electron-packager mydirhere myappname --all" and "electron-packager . --all"
I tried using "CMD" and "PowerShell", both result in the same error.

Have you tried running it through an NPM script?

I use "npm build":
"scripts": {
"start": "electron .",
"build" : "electron-packager . --all"
}

So what you're saying is that npm build doesn't work. If that is the case, try uninstalling Electron Packager globally and add it as one of the devDependencies.

I used devDependencies, not work
Used npm install electron-packager --save-dev for install

Result: npm build
screenshot (http://prntscr.com/e4m5ui)

My Package.json

{
  "name": "electron-quick-start",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-packager . --all"
  },
  "repository": "https://github.com/electron/electron-quick-start",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "^1.4.1",
    "electron-packager": "^8.5.1"
  }
}

Can you send the exact error message in CMD

You should also install electron itself locally:

npm install electron --save-dev

It seems that you sytem path variable is dirty.

What is the output of $env:PSModulePath in PS, and are all paths well escaped and delimited

And why are you building from PS as admin, and not as local user from cmd or with .bat file, just curious?

Error Message

`O termo 'electron-packager' n茫o 茅 reconhecido como nome de cmdlet, fun莽茫o, arquivo de script ou programa oper谩vel. Veri
fique a grafia do nome ou, se um caminho tiver sido inclu铆do, veja se o caminho est谩 correto e tente novamente.
Em linha:1 caractere:18

  • electron-packager <<<<

    • CategoryInfo : ObjectNotFound: (electron-packager:String) [], CommandNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException`

English:

`The term 'electron-packager' is not recognized as a cmdlet name, function, script file, or operating program. Veri
If you are looking for a friend or a friend, click here.
Online: 1 character: 18

  • Electron Packer <<<<
  • CategoryInfo: ObjectNotFound: (electron-packager: String) [], CommandNotFoundException
  • FullyQualifiedErrorId: CommandNotFoundException`

PS Module Patch

C:\Users\Administrador\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

I used npm install electron --save-dev

And why are you building from PS as admin, and not the local user from cmd or with .bat file, just curious?

I am using Administrator Account

There are lots of things that can cause such an error, For instance you have a space in your project folder name and you are sending command from PS. Broken global path variable, which you have to debug by yourself, etc. There's nothing I can do about it. It's your app, and your workflow, so it is you who is to provide full info of your paltform and your project repo. Not in the manner like patient examined by the doctor.

BTW I tested electron-packager globally and locally with cmd and PS as admin and as user, and it worked. My machine is Windows 10 x64.

What's your $PSVersionTable.PSVersion?
I'm using

Major 2
Minor 0
Build -1
Revision -1

Why do you use PS. Go to your project folder in cmd.exe and send commnd

electron-packager . --all --electron-version=1.4.15

Are you debugging your PS, or trying to figure out why electron-packager is not recognized?

Localized Windows 7 x64 and with PowerShell is a tricky tool for development.

$PSVersionTable.PSVersion on Windows 10 x64:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      0      10586  494

screenshot (http://prntscr.com/e4sxce)

'electron-packager' n茫o 茅 reconhecido como um comando in ou externo, um programa oper谩vel ou um arquivo em lotes.

English:

'electron-packager' is not recognized as a command in or external, an operational program or a batch file.

Install electron and electron-packager globally:

npm install -g electron electron-packager

This will install electron 1.4.15 and electron-packager 8.5.1 into your user folder, not in project folder:

C:\Users\Administrador\AppData\Roaming\npm

or it can be some Documents and Settings, anyway you dont have to bother about this folder and touch anything there.

Delete if present node_modules folder in your project folder.
go in cmd. exe to your project folder:

electron-packager . --all --electron-version=1.4.15

Dont use PS, use cmd.exe

worked perfectly, I had followed tutorial videos (youtube) but it did not work, followed his steps worked!
Thank you very much :)

FYI, it is not recommended to install the electron module globally. That just introduces more problems down the road.

npm install electron-packager -g
npm install electron-packager --save-dev

Install both locally as well as globally will solve the issue

Try installing the electron-packager globally. Because sometimes when you install electron-packager in normal way it get installed for some parts of your projects. Due to which it may require some attention.

You can try run running the command by opening cmd in your project folder -

npm install -g electron electron-packager

npm install electron-packager -g

Installing it globally resolved my issue. Thanks!

The recommended way to install and run electron-packager is to install it as a devDependency to your app, and then invoke it via an npm script.

Was this page helpful?
0 / 5 - 0 ratings