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

Cannot use native modules when asar is enabled #740

Closed
JackieLs opened this issue Oct 24, 2017 · 7 comments
Closed

Cannot use native modules when asar is enabled #740

JackieLs opened this issue Oct 24, 2017 · 7 comments
Labels
needs info Issue reporter needs to provide more information for maintainers to take action

Comments

@JackieLs
Copy link

Just Like the image.I run this in dev type is very ok. But When I package it, something go wrong....
image

@malept malept added the needs info Issue reporter needs to provide more information for maintainers to take action label Oct 24, 2017
@malept
Copy link
Member

malept commented Oct 24, 2017

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

  • Console output when you run electron-packager with the environment variable DEBUG=electron-packager. Please include the stack trace if one exists.

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

  • What does your package.json look like?

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

@JackieLs
Copy link
Author

JackieLs commented Oct 25, 2017

Sorry, so late to provide these info.
the config.

module.exports = {
	appVersion: pkg.version,
	arch: ['x64'], // ia32, x64, armv7l, all
	asar: true,
	dir: path.join(__dirname, '../app'),
	icon: path.join(__dirname, '../app/icons/icon'),
	ignore: /renderer/,
	out: path.join(__dirname, '../builds'),
	overwrite: true,
	platform: process.env.PLATFORM_TARGET,
	extraResource: [ 
		path.join(__dirname, '../app/mind/mind_darwin'), 
		path.join(__dirname, '../app/mind/mind_win32.exe')
	]
}

And I solved this problem after I remove the asar: true (default: false) opt on Windows.
I've read a lot of issue. Maybe this should not be the electron-packager's duty.
I'm not sure.But Windows is really confusing.
Thx. @malept

@malept malept changed the title Build Error On Windows Cannot use native modules when asar is enabled Oct 25, 2017
@malept
Copy link
Member

malept commented Oct 25, 2017

This is a known issue with asar and native modules, and also why I hesitate to make asar default to true.

@leozzyzheng
Copy link

I'm facing the same problem, I think the native module should be copied beside the asar file not the temp folder, and the require should be able to load the node module outside the asar file.

@leozzyzheng
Copy link

set --asar.unpack=*.{node,dll} in command line or set asar: { unpack: '*.{node,dll}' } in config object will do the trick.

@robosushie
Copy link

set --asar.unpack=*.{node,dll} in command line or set asar: { unpack: '*.{node,dll}' } in config object will do the trick.

I tried the same config, but I am getting the same issue, but this time it is not referencing the temp folder.
Please check this link for the details.

Thanks

@xmsz
Copy link

xmsz commented Oct 14, 2023

i want to hide the dll in app.asar

eliandoran added a commit to TriliumNext/Notes that referenced this issue Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Issue reporter needs to provide more information for maintainers to take action
Projects
None yet
Development

No branches or pull requests

5 participants