Electron-forge: Failing to package due to NPM 5.3.0

Created on 19 Jul 2017  路  4Comments  路  Source: electron-userland/electron-forge

  • [x ] I have read the contribution documentation for this project.
  • [x ] I agree to follow the code of conduct that this project follows, as appropriate.
  • [x ] I have searched the issue tracker for an issue that matches the one I want to file, without success.

After creating a new project with electron-forge init, or even on an older project where the package command used to work, the electron-forge package command now fails.

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle

An unhandled rejection has occurred inside Forge:
Command failed: npm prune --production
npm WARN [email protected] No repository field.

npm ERR! May not delete: C:\Users\robertf\AppData\Local\Temp\electron-packager\win32-x64\mbl-agent-win32-x64\resources\app\node_modules\.bin

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\robertf\AppData\Roaming\npm-cache\_logs\2017-07-19T09_23_13_479Z-debug.log

Error: Command failed: npm prune --production
npm WARN [email protected] No repository field.

npm ERR! May not delete: C:\Users\robertf\AppData\Local\Temp\electron-packager\win32-x64\mbl-agent-win32-x64\resources\app\node_modules\.bin

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\robertf\AppData\Roaming\npm-cache\_logs\2017-07-19T09_23_13_479Z-debug.log

    at ChildProcess.exithandler (child_process.js:270:12)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:897:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)

What command line arguments are you passing?

electron-forge package

What does your config.forge data in package.json look like?

"config": {
        "forge": {
            "make_targets": {
                "win32": [
                    "squirrel"
                ],
                "darwin": [
                    "zip"
                ],
                "linux": [
                    "deb",
                    "rpm"
                ]
            },
            "electronPackagerConfig": {
                "asar": false,
                "dir": "./src",
                "platform": [
                    "linux",
                    "win32"
                ],
                "arch": [
                    "ia32",
                    "x64"
                ],
                "ignore": [
                    ".vscode",
                    "idea"
                ]
            },
            "electronWinstallerConfig": {
                "name": "mbl_agent"
            },
            "electronInstallerDebian": {},
            "electronInstallerRedhat": {},
            "github_repository": {
                "owner": "",
                "name": ""
            },
            "windowsStoreConfig": {
                "packageName": "",
                "name": "mblagent"
            }
        }
    }

I've tried deleting the mentioned folder by hand, but it doesn't change the error. It seems to just fail on the npm prune --production line.

I'm at a complete loss as to what could have changed.

Most helpful comment

For ease of others landing here, this was fixed in npm 5.4.0 so just update your npm with:

npm update -g npm

And you should be good to go.

All 4 comments

What version of NPM are you using?

Edit: I'm guessing you're on NPM 5.3 and hitting https://github.com/npm/npm/issues/17781, you'll need to downgrade to 5.2 for now.

That worked. I'm pretty sure it will be fixed eventually, so I'm closing this.

For ease of others landing here, this was fixed in npm 5.4.0 so just update your npm with:

npm update -g npm

And you should be good to go.

If you're in Windows, upgrade NPM by running from an Admin PowerShell:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
Was this page helpful?
0 / 5 - 0 ratings

Related issues

chenzhiguo picture chenzhiguo  路  5Comments

denn-s picture denn-s  路  3Comments

liamdawson picture liamdawson  路  4Comments

mistermicheels picture mistermicheels  路  4Comments

Neurrone picture Neurrone  路  4Comments