Skip to content
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

node-pre-gyp stripped in packed dir #1815

Closed
TimNZ opened this issue Jul 11, 2017 · 8 comments
Closed

node-pre-gyp stripped in packed dir #1815

TimNZ opened this issue Jul 11, 2017 · 8 comments
Labels

Comments

@TimNZ
Copy link

TimNZ commented Jul 11, 2017

  • Version: 19.15.2
  • Target: Windows x64

node_modules/node-pre-gyp is being stripped from the built dir win-unpacked

I have tried placing 'node_modules/node-pre-gyp' into asarUnpack, but it is still missing from app.asar.unpacked and app.asar.

It is required by module 'sqlite3'.

Other modules I specify in asarUnpack are placed in app.asar.unpacked.

@TimNZ TimNZ changed the title sequelize + sqlite3 on Windows node-pre-gyp stripped in packed dir Jul 11, 2017
@TimNZ
Copy link
Author

TimNZ commented Jul 11, 2017

partial 'build' fragment:

	"asarUnpack": [
		"node_modules/rx-dom",
		"node_modules/fsevents",
		"node_modules/sqlite3",
		"node_modules/node-pre-gyp"
	],

Aside from node-pre-gyp missing from built package dir, the other modules are still being placed in app.asar as well as app.asar.unpacked.
require('sqlite3') is picking up version inside app.asar, but I have placed a copy of node-pre-gyp dir into app.asar.unpacked, so it does not get required, resulting in an error.

@TimNZ
Copy link
Author

TimNZ commented Jul 11, 2017

Ok, I have now discovered that your packing logic strips out sub node_modules.
In this case sqlite3/node_modules is removed, which contains node-pre-gyp.
Copying it back in manually fixes things.

I would have to spend a lot of time tracing through electron-builder code to understand what is happening, @develar can you please provide a summary of what you think and how to fix this?

@develar
Copy link
Member

develar commented Jul 11, 2017

Thanks for using prerelease, node-pre-gup is filtered out because not required for production. Yeah, I will check why sql requires it.

@TimNZ
Copy link
Author

TimNZ commented Jul 11, 2017

This is top the of main file for sqlite3, no way to avoid it.

var binary = require('node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));

@develar
Copy link
Member

develar commented Jul 11, 2017

Ok, node-pre-gyp should be not used — prebuild is much better. But we cannot teach users and fight with existing modules. I will release 19.5.5 in several hours. prebuild will be still removed to reduce app size. Someday someone will fix sqlite3.

@TimNZ
Copy link
Author

TimNZ commented Jul 11, 2017

Thanks!

@develar develar added the bug label Jul 11, 2017
@develar
Copy link
Member

develar commented Jul 11, 2017

Fixed in 19.15.5

@TimNZ
Copy link
Author

TimNZ commented Jul 11, 2017

Works great, thanks @develar for the super awesome quick fix.
I will make a donation next week using hopefully proceeds of product sales.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants