New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron-packager encounters error during prune with npm 5.3.0 #686

Closed
gerges opened this Issue Jul 18, 2017 · 12 comments

Comments

Projects
None yet
6 participants
@gerges

gerges commented Jul 18, 2017

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

Please describe your issue:

Console output when you run electron-packager. Please include the stack trace if one exists.

Encountered error while building
  { Error: Command failed: npm prune --production
npm ERR! May not delete: /private/var/folders/v1/901xmbvx413g7vfw031f7f300000gp/T/electron-packager/darwin-x64/myapp-darwin-x64/Electron.app/Contents/Resources/app/node_modules/.bin

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/igerges/.npm/_logs/2017-07-18T20_54_00_332Z-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 Socket.stream.socket.on (internal/child_process.js:340:11)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at Pipe._handle.close [as _onclose] (net.js:548:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'npm prune --production' }

What command line arguments are you passing? Alternatively, if you are using the API, what
parameters are you passing to the packager() function?

{
prune: true
}

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-quick-start
is a good starting point.

App build consistently fails with the above error after

npm install -g npm

but works consistently if downgraded to

npm install -g npm@5.2.0

@malept

This comment has been minimized.

Member

malept commented Jul 18, 2017

Could you please see if there's an issue for this in NPM's issue tracker?

@gerges

This comment has been minimized.

gerges commented Jul 18, 2017

@malept, apologies, I should have checked there first! npm/npm#17781

@gerges gerges closed this Jul 18, 2017

@fasterthanlime fasterthanlime referenced this issue Jul 19, 2017

Closed

npm@5.3: npm prune --production fails #17781

1 of 4 tasks complete
@ghjdegithub

This comment has been minimized.

ghjdegithub commented Jul 20, 2017

npm ERR! May not delete
npm install -g npm@5.2.0

@malept

This comment has been minimized.

Member

malept commented Jul 20, 2017

That's probably a permissions problem, but it's not something I can help with, you may have better luck on a general Node forum.

@joshuapinter

This comment has been minimized.

joshuapinter commented Aug 27, 2017

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.

@dougludlow

This comment has been minimized.

dougludlow commented Sep 14, 2017

I'm getting another, seemingly related, error in 5.4.1:

 Error: Command failed: npm prune --production
module.js:491
    throw err;
    ^

Error: Cannot find module 'electron-download'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\doug\AppData\Local\Temp\electron-packager\win32-x64\app-win32-x64\resources\app\node_modules\electron\install.js:10:16)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
npm WARN Error: EPERM: operation not permitted, unlink 'C:\Users\doug\AppData\Local\Temp\electron-packager\win32-x64\app-win32-x64\resources\app\node_modules\electron\node_modules\@types\node\package.json'
npm WARN  { Error: EPERM: operation not permitted, unlink 'C:\Users\doug\AppData\Local\Temp\electron-packager\win32-x64\app-win32-x64\resources\app\node_modules\electron\node_modules\@types\node\package.json'
npm WARN   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\doug\\AppData\\Local\\Temp\\electron-packager\\win32-x64\\app-win32-x64\\resources\\app\\node_modules\\electron\\node_modules\\@types\\node\\package.json\'',
npm WARN   errno: -4048,
npm WARN   code: 'EPERM',
npm WARN   syscall: 'unlink',
npm WARN   path: 'C:\\Users\\doug\\AppData\\Local\\Temp\\electron-packager\\win32-x64\\app-win32-x64\\resources\\app\\node_modules\\electron\\node_modules\\@types\\node\\package.json' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.6 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.7.6 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\doug\AppData\Roaming\npm-cache\_logs\2017-09-14T21_35_15_517Z-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:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
@malept

This comment has been minimized.

Member

malept commented Sep 14, 2017

@dougludlow your error is a known NPM bug: npm/npm#18380

@malept

This comment has been minimized.

Member

malept commented Sep 14, 2017

A workaround is to set packageManager: false in the Packager API, or --no-package-manager with the Packager CLI.

@dougludlow

This comment has been minimized.

dougludlow commented Sep 14, 2017

Thanks for the quick reply, @malept. Now I'm seeing the following error:

Error: Failed to locate module "electron" from "C:\Users\doug\AppData\Local\Temp\electron-packager\win32-x64\app-win32-x64\resources\app"

        This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager).  Or your module installation failed.
    at Walker.<anonymous> (C:\Users\doug\source\app\node_modules\pruner\lib\Walker.js:94:35)
    at step (C:\Users\doug\source\app\node_modules\pruner\lib\Walker.js:32:23)
    at Object.next (C:\Users\doug\source\app\node_modules\pruner\lib\Walker.js:13:53)
    at fulfilled (C:\Users\doug\source\app\node_modules\pruner\lib\Walker.js:4:58)
    at <anonymous>

I've tried downgrading to npm@5.2, but I'm still seeing the same issue. I'm running node@8.4.0.

@malept

This comment has been minimized.

Member

malept commented Sep 14, 2017

Per the NPM bug, delete any lock files you may have, wipe your NPM cache and re-run npm install before attempting to run Electron Packager again.

@dougludlow

This comment has been minimized.

dougludlow commented Sep 14, 2017

Yeah, idk, I'm guessing it's just some incompatibility with npm 5 and node 8. It appears to be working fine on my build server with node 7 and npm 4. I'll prolly just need to downgrade again.

@xn

This comment has been minimized.

xn commented May 2, 2018

@dougludlow I ran into this problem because one of the other devs added "electron": "^1.8.4" to dependencies, because ember electron was failing for one reason or another and that fixed their problem. Running make with DEBUG=electron-packager uncovered the culprit:

electron-packager Ignored path regular expressions: [ '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt(-compile)?($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$' ] +0ms

I hope this helps anyone else running into this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment