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

Unpacked paths that include the Windows \\?\ hack to support long paths do not resolve #129

Open
grantcv1 opened this issue Sep 12, 2017 · 4 comments

Comments

@grantcv1
Copy link

grantcv1 commented Sep 12, 2017

I believe my issue is related to #75, but nobody is responding to my comments on that issue.

I am getting the following error when I try and run my installed app on Windows:

Uncaught Error: The specified module could not be found.
\?\C:\Users\myuserid\AppData\Local\Programs\MyApp\resources\app.asar.unpacked\AmdGen\node_modules\java\build\Release\nodejavabridge_bindings.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\myuserid\AppData\Local\Programs\MyApp\resources\app.asar.unpacked\AmdGen\node_modules\java\lib\nodeJavaBridge.js:21:16)
at Object. (C:\Users\myuserid\AppData\Local\Programs\MyApp\resources\app.asar.unpacked\AmdGen\node_modules\java\lib\nodeJavaBridge.js:316:3)
GUI.js:33 Uncaught TypeError: Cannot read property 'on' of undefined
at onLoad (GUI.js:33)
at onload (Index.html:8)

I have verified that the nodejavabridge_bindings.node file has indeed been unpacked and exists at the path specified.

Note: The \?\ prefix before the C: is apparently a hack from Microsoft that triggers proper support for long paths. I'm not sure what is adding that prefix as it appears from the stack trace that the path started without it and it was added before calling dlopen in ELECTRON_ASAR.js where the failure apparently happens. (https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath)

I am using electron-builder to create my installer.

I tried resolving this problem by manually adding the following to the "build" portion of my package.json file before building the installer:

"asar": true,
"asarUnpack": "**\\*.node",

That did not help.

My suspicion is that the \?\ prefix has, at some point, been introduced to allow electron (or Node.js) to support long paths on the Windows platform, but something in the dlopen() method inside ELECTRON_ASAR.js doesn't understand this weird notation.

I'm currently at electron version 1.7.5 and electron-builder version 19.20.1.

@grantcv1 grantcv1 changed the title Unpacked paths that include the Windows hack to support long paths do not resolve Unpacked paths that include the Windows \\?\ hack to support long paths do not resolve Sep 12, 2017
@MichaelIT
Copy link

It is not a bug of asar after my 2 day digging.
In my case, I use node-java.It throw flowing error:

Uncaught Error: %1 is not a valid Win32 application.
\\?\F:\tmp\test\win-ia32-unpacked\resources\app\node_modules\java\build\Release\nodejavabridge_bindings.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (F:\tmp\test\win-ia32-unpacked\resources\app\node_modules\java\lib\nodeJavaBridge.js:21:16)
    at Object.<anonymous> (F:\tmp\test\win-ia32-unpacked\resources\app\node_modules\java\lib\nodeJavaBridge.js:316:3)

I flow laggingreflex's idea.
soldair/node-qrcode#22
native module can not be load because it's dependences was missing.
U can use dependencywalker to found out what denpendences was missing, and try to copy to path of entry or add to system path environment variable!

@vuamitom
Copy link

In my case with node sqlcipher, I got this error on Window 7
Uncaught Error: The specified module could not be found. \\?\C:\Users\Administrator\AppData\Local\Temp\68C3.tmp.node

Problem was due to missing dll. Adding these to application folder solved it.

icudt57.dll
icuin57.dll
icuuc57.dll
libeay32.dll
msvcp120.dll
msvcr120.dll
ssleay32.dll

@yuwanlin
Copy link

if you use electron-builder, you can use config.extraFiles, copy files from your node addon directory(include dll) to electron root.

{
  from: 'src/addon',
  to: './'
}

@LZQCN
Copy link

LZQCN commented Nov 14, 2023

The reason for this error may be the .node file cannot find its required .dll files.

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

No branches or pull requests

5 participants