Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Error: Module did not self-register while using native node module #161

Closed
s-a opened this issue Jul 14, 2017 · 37 comments
Closed

Error: Module did not self-register while using native node module #161

s-a opened this issue Jul 14, 2017 · 37 comments
Labels

Comments

@s-a
Copy link

s-a commented Jul 14, 2017

I am using webworker-threads and compiled WebWorkerThreads.node with exact the same node version pkg packaged the exececutable (v6.10.3). Do I miss some todo(s) else anywhere to use a native module? I also tried pkg . -boption with the same result.

@s-a s-a changed the title Error: Module did not self-register Error: Module did not self-register while using native node module Jul 14, 2017
@igorklopov
Copy link
Contributor

igorklopov commented Jul 15, 2017

Please try again with pkg@4.1.2. There were changes that can affect your issue.

@s-a
Copy link
Author

s-a commented Jul 15, 2017

Nope :(

Same again. But new pkg version seems not to search .node files in build subfolder anymore 👍

Here is the console output...

c:\git\test>node -v
v6.10.3

c:\git\test>test-win.exe
pkg/prelude/bootstrap.js:1102
      throw error;
      ^

Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at Module.require (pkg/prelude/bootstrap.js:1083:31)
    at require (internal/module.js:20:19)
    at bindings (C:\snapshot\test\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (C:\snapshot\test\node_modules\webworker-threads\index.js:1:105)
    at Module._compile (pkg/prelude/bootstrap.js:1173:22)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)

When I console.log(process.version) the version within .exe seems fine. So I do not have any idea ...

@igorklopov
Copy link
Contributor

Be sure your native addon does not require any dynamically linked DLL. Use Dependency Walker against .node files.

@s-a
Copy link
Author

s-a commented Jul 17, 2017

Can you point me to Dependency Walker download url? I have never heard about.

@igorklopov
Copy link
Contributor

@s-a
Copy link
Author

s-a commented Jul 17, 2017

I do not notice any inconsistencies here. Here is the result:

# Not found:
API-MS-WIN-CORE-APIQUERY-L1-1-0.DLL
API-MS-WIN-CORE-APPCOMPAT-L1-1-1.DLL
API-MS-WIN-CORE-APPINIT-L1-1-0.DLL
API-MS-WIN-CORE-ATOMS-L1-1-0.DLL
API-MS-WIN-CORE-COMM-L1-1-0.DLL
API-MS-WIN-CORE-CONSOLE-L1-1-0.DLL
API-MS-WIN-CORE-CONSOLE-L2-1-0.DLL
API-MS-WIN-CORE-CRT-L1-1-0.DLL
API-MS-WIN-CORE-CRT-L2-1-0.DLL
API-MS-WIN-CORE-DATETIME-L1-1-1.DLL
API-MS-WIN-CORE-DATETIME-L1-1-2.DLL
API-MS-WIN-CORE-DEBUG-L1-1-1.DLL
API-MS-WIN-CORE-DELAYLOAD-L1-1-1.DLL
API-MS-WIN-CORE-ENCLAVE-L1-1-0.DLL
API-MS-WIN-CORE-ERRORHANDLING-L1-1-1.DLL
API-MS-WIN-CORE-ERRORHANDLING-L1-1-3.DLL
API-MS-WIN-CORE-FIBERS-L1-1-1.DLL
API-MS-WIN-CORE-FIBERS-L2-1-1.DLL
API-MS-WIN-CORE-FILE-L1-2-1.DLL
API-MS-WIN-CORE-FILE-L1-2-2.DLL
API-MS-WIN-CORE-FILE-L2-1-1.DLL
API-MS-WIN-CORE-FILE-L2-1-2.DLL
API-MS-WIN-CORE-HANDLE-L1-1-0.DLL
API-MS-WIN-CORE-HEAP-L1-2-0.DLL
API-MS-WIN-CORE-HEAP-L2-1-0.DLL
API-MS-WIN-CORE-HEAP-OBSOLETE-L1-1-0.DLL
API-MS-WIN-CORE-INTERLOCKED-L1-2-0.DLL
API-MS-WIN-CORE-IO-L1-1-1.DLL
API-MS-WIN-CORE-JOB-L1-1-0.DLL
API-MS-WIN-CORE-KERNEL32-LEGACY-L1-1-1.DLL
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-2.DLL
API-MS-WIN-CORE-LARGEINTEGER-L1-1-0.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L1-2-0.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L1-2-1.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L2-1-0.DLL
API-MS-WIN-CORE-LOCALIZATION-L1-2-1.DLL
API-MS-WIN-CORE-LOCALIZATION-L2-1-0.DLL
API-MS-WIN-CORE-LOCALIZATION-OBSOLETE-L1-3-0.DLL
API-MS-WIN-CORE-LOCALIZATION-PRIVATE-L1-1-0.DLL
API-MS-WIN-CORE-MEMORY-L1-1-2.DLL
API-MS-WIN-CORE-MISC-L1-1-0.DLL
API-MS-WIN-CORE-NAMEDPIPE-L1-2-0.DLL
API-MS-WIN-CORE-NAMEDPIPE-L1-2-2.DLL
API-MS-WIN-CORE-NAMESPACE-L1-1-0.DLL
API-MS-WIN-CORE-NORMALIZATION-L1-1-0.DLL
API-MS-WIN-CORE-PATH-L1-1-0.DLL
API-MS-WIN-CORE-PERFCOUNTERS-L1-1-0.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-CORE-PROCESSENVIRONMENT-L1-2-0.DLL
API-MS-WIN-CORE-PROCESSSNAPSHOT-L1-1-0.DLL
API-MS-WIN-CORE-PROCESSTHREADS-L1-1-2.DLL
API-MS-WIN-CORE-PROCESSTHREADS-L1-1-3.DLL
API-MS-WIN-CORE-PROCESSTOPOLOGY-L1-2-0.DLL
API-MS-WIN-CORE-PROFILE-L1-1-0.DLL
API-MS-WIN-CORE-PSAPI-ANSI-L1-1-0.DLL
API-MS-WIN-CORE-PSAPI-L1-1-0.DLL
API-MS-WIN-CORE-PSAPI-OBSOLETE-L1-1-0.DLL
API-MS-WIN-CORE-REALTIME-L1-1-0.DLL
API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL
API-MS-WIN-CORE-REGISTRY-L1-1-1.DLL
API-MS-WIN-CORE-RTLSUPPORT-L1-2-0.DLL
API-MS-WIN-CORE-SIDEBYSIDE-L1-1-0.DLL
API-MS-WIN-CORE-STRING-L1-1-0.DLL
API-MS-WIN-CORE-STRING-L2-1-0.DLL
API-MS-WIN-CORE-STRING-OBSOLETE-L1-1-0.DLL
API-MS-WIN-CORE-STRINGANSI-L1-1-0.DLL
API-MS-WIN-CORE-SYNCH-L1-1-0.DLL
API-MS-WIN-CORE-SYNCH-L1-2-0.DLL
API-MS-WIN-CORE-SYNCH-L1-2-1.DLL
API-MS-WIN-CORE-SYSINFO-L1-2-1.DLL
API-MS-WIN-CORE-SYSINFO-L1-2-3.DLL
API-MS-WIN-CORE-SYSTEMTOPOLOGY-L1-1-0.DLL
API-MS-WIN-CORE-THREADPOOL-L1-2-0.DLL
API-MS-WIN-CORE-THREADPOOL-LEGACY-L1-1-0.DLL
API-MS-WIN-CORE-THREADPOOL-PRIVATE-L1-1-0.DLL
API-MS-WIN-CORE-TIMEZONE-L1-1-0.DLL
API-MS-WIN-CORE-UTIL-L1-1-0.DLL
API-MS-WIN-CORE-WINDOWSERRORREPORTING-L1-1-0.DLL
API-MS-WIN-CORE-WOW64-L1-1-0.DLL
API-MS-WIN-CORE-WOW64-L1-1-1.DLL
API-MS-WIN-CORE-XSTATE-L2-1-0.DLL
API-MS-WIN-DEVICES-CONFIG-L1-1-1.DLL
API-MS-WIN-EVENTING-CLASSICPROVIDER-L1-1-0.DLL
API-MS-WIN-EVENTING-CONSUMER-L1-1-0.DLL
API-MS-WIN-EVENTING-CONTROLLER-L1-1-0.DLL
API-MS-WIN-EVENTING-OBSOLETE-L1-1-0.DLL
API-MS-WIN-EVENTING-PROVIDER-L1-1-0.DLL
API-MS-WIN-MM-JOYSTICK-L1-1-0.DLL
API-MS-WIN-MM-MISC-L1-1-1.DLL
API-MS-WIN-MM-MME-L1-1-0.DLL
API-MS-WIN-MM-TIME-L1-1-0.DLL
API-MS-WIN-SECURITY-APPCONTAINER-L1-1-0.DLL
API-MS-WIN-SECURITY-AUDIT-L1-1-1.DLL
API-MS-WIN-SECURITY-BASE-L1-2-0.DLL
API-MS-WIN-SECURITY-BASE-PRIVATE-L1-1-1.DLL
API-MS-WIN-SECURITY-GROUPPOLICY-L1-1-0.DLL
API-MS-WIN-SERVICE-CORE-L1-1-1.DLL
API-MS-WIN-SERVICE-CORE-L1-1-2.DLL
API-MS-WIN-SERVICE-MANAGEMENT-L1-1-0.DLL
API-MS-WIN-SERVICE-MANAGEMENT-L2-1-0.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-0
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-2.DLL
API-MS-WIN-SERVICE-WINSVC-L1-2-0.DLL
API-MS-WIN-APPMODEL-IDENTITY-L1-2-0.DLL
API-MS-WIN-APPMODEL-RUNTIME-INTERNAL-L1-1-0.DLL
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-APPMODEL-RUNTIME-L1-1-1.DLL
API-MS-WIN-APPMODEL-STATE-L1-2-0.DLL
API-MS-WIN-APPMODEL-UNLOCK-L1-1-0.DLL
API-MS-WIN-BASE-UTIL-L1-1-0.DLL
API-MS-WIN-CORE-CALENDAR-L1-1-0.DLL
API-MS-WIN-CORE-COM-L1-1-0
API-MS-WIN-CORE-COM-L1-1-1.DLL
API-MS-WIN-CORE-COM-L2-1-1.DLL
API-MS-WIN-CORE-COM-MIDLPROXYSTUB-L1-1-0.DLL
API-MS-WIN-CORE-COM-PRIVATE-L1-1-0.DLL
API-MS-WIN-CORE-COM-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-DEBUG-L1-1-0.DLL
API-MS-WIN-CORE-DELAYLOAD-L1-1-0.DLL
API-MS-WIN-CORE-ERRORHANDLING-L1-1-0.DLL
API-MS-WIN-CORE-FIBERS-L1-1-0.DLL
API-MS-WIN-CORE-FILE-L1-1-0.DLL
API-MS-WIN-CORE-FILE-L1-2-0.DLL
API-MS-WIN-CORE-FILE-L2-1-0.DLL
API-MS-WIN-CORE-HEAP-L1-1-0.DLL
API-MS-WIN-CORE-INTERLOCKED-L1-1-0.DLL
API-MS-WIN-CORE-IO-L1-1-0.DLL
API-MS-WIN-CORE-JOB-L2-1-0.DLL
API-MS-WIN-CORE-KERNEL32-LEGACY-L1-1-0.DLL
API-MS-WIN-CORE-KERNEL32-LEGACY-L1-1-4.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L1-1-0.DLL
API-MS-WIN-CORE-LOCALIZATION-L1-1-0.DLL
API-MS-WIN-CORE-LOCALIZATION-L1-2-0.DLL
API-MS-WIN-CORE-LOCALIZATION-L1-2-2.DLL
API-MS-WIN-CORE-LOCALIZATION-OBSOLETE-L1-2-0.DLL
API-MS-WIN-CORE-LOCALREGISTRY-L1-1-0.DLL
API-MS-WIN-CORE-MARSHAL-L1-1-0.DLL
API-MS-WIN-CORE-MEMORY-L1-1-0.DLL
API-MS-WIN-CORE-PROCESSENVIRONMENT-L1-1-0.DLL
API-MS-WIN-CORE-PROCESSTHREADS-L1-1-0.DLL
API-MS-WIN-CORE-PROCESSTHREADS-L1-1-1.DLL
API-MS-WIN-CORE-PROCESSTOPOLOGY-OBSOLETE-L1-1-0.DLL
API-MS-WIN-CORE-PSM-APPNOTIFY-L1-1-0.DLL
API-MS-WIN-CORE-PSM-KEY-L1-1-0.DLL
API-MS-WIN-CORE-QUIRKS-L1-1-0.DLL
API-MS-WIN-CORE-REALTIME-L1-1-1.DLL
API-MS-WIN-CORE-REGISTRY-L2-2-0.DLL
API-MS-WIN-CORE-REGISTRY-PRIVATE-L1-1-0.DLL
API-MS-WIN-CORE-REGISTRYUSERSPECIFIC-L1-1-0.DLL
API-MS-WIN-CORE-RTLSUPPORT-L1-1-0.DLL
API-MS-WIN-CORE-SHLWAPI-LEGACY-L1-1-0.DLL
API-MS-WIN-CORE-SHLWAPI-OBSOLETE-L1-2-0.DLL
API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
API-MS-WIN-CORE-STRING-L2-1-1.DLL
API-MS-WIN-CORE-SYSINFO-L1-1-0.DLL
API-MS-WIN-CORE-SYSINFO-L1-2-0.DLL
API-MS-WIN-CORE-TOOLHELP-L1-1-0.DLL
API-MS-WIN-CORE-URL-L1-1-0.DLL
API-MS-WIN-CORE-VERSION-L1-1-0.DLL
API-MS-WIN-CORE-VERSION-L1-1-1.DLL
API-MS-WIN-CORE-VERSION-PRIVATE-L1-1-0.DLL
API-MS-WIN-CORE-VERSIONANSI-L1-1-0.DLL
API-MS-WIN-CORE-VERSIONANSI-L1-1-1.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-1.DLL
API-MS-WIN-CORE-WINRT-ERRORPRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-PROPERTYSETPRIVATE-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-PROPERTYSETPRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-WINRT-REGISTRATION-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-COREUI-SECRUNTIME-L1-1-0.DLL
API-MS-WIN-CRT-LOCALE-L1-1-0.DLL
API-MS-WIN-CRT-PRIVATE-L1-1-0.DLL
API-MS-WIN-CRT-RUNTIME-L1-1-0.DLL
API-MS-WIN-CRT-STRING-L1-1-0.DLL
API-MS-WIN-CRT-TIME-L1-1-0.DLL
API-MS-WIN-DEVICES-QUERY-L1-1-1.DLL
API-MS-WIN-DOWNLEVEL-ADVAPI32-L1-1-0.DLL
API-MS-WIN-DOWNLEVEL-ADVAPI32-L2-1-0.DLL
API-MS-WIN-DOWNLEVEL-KERNEL32-L2-1-0.DLL
API-MS-WIN-DOWNLEVEL-NORMALIZ-L1-1-0.DLL
API-MS-WIN-DOWNLEVEL-OLE32-L1-1-0.DLL
API-MS-WIN-DOWNLEVEL-SHELL32-L1-1-0.DLL
API-MS-WIN-DOWNLEVEL-SHLWAPI-L1-1-0.DLL
API-MS-WIN-DOWNLEVEL-SHLWAPI-L2-1-0.DLL
API-MS-WIN-DOWNLEVEL-SHLWAPI-L2-1-1.DLL
API-MS-WIN-DOWNLEVEL-USER32-L1-1-0.DLL
API-MS-WIN-DOWNLEVEL-VERSION-L1-1-0.DLL
API-MS-WIN-DX-D3DKMT-L1-1-0.DLL
API-MS-WIN-DX-D3DKMT-L1-1-1.DLL
API-MS-WIN-EVENTING-LEGACY-L1-1-0.DLL
API-MS-WIN-EVENTING-TDH-L1-1-0.DLL
API-MS-WIN-EVENTLOG-LEGACY-L1-1-0.DLL
API-MS-WIN-GDI-DPIINFO-L1-1-0.DLL
API-MS-WIN-MM-MISC-L2-1-0.DLL
API-MS-WIN-NTUSER-IE-MESSAGE-L1-1-0.DLL
API-MS-WIN-NTUSER-SYSPARAMS-L1-1-0.DLL
API-MS-WIN-OLE32-IE-L1-1-0.DLL
API-MS-WIN-POWER-BASE-L1-1-0.DLL
API-MS-WIN-POWER-SETTING-L1-1-0.DLL
API-MS-WIN-RTCORE-NTUSER-CLIPBOARD-L1-1-0.DLL
API-MS-WIN-RTCORE-NTUSER-PRIVATE-L1-1-0.DLL
API-MS-WIN-RTCORE-NTUSER-PRIVATE-L1-1-1.DLL
API-MS-WIN-RTCORE-NTUSER-SYNCH-L1-1-0.DLL
API-MS-WIN-RTCORE-NTUSER-WINDOW-L1-1-0.DLL
API-MS-WIN-RTCORE-NTUSER-WINEVENT-L1-1-0.DLL
API-MS-WIN-SECURITY-ACCESSHLPR-L1-1-0.DLL
API-MS-WIN-SECURITY-ACTIVEDIRECTORYCLIENT-L1-1-0.DLL
API-MS-WIN-SECURITY-ACTIVEDIRECTORYCLIENT-L1-1-1.DLL
API-MS-WIN-SECURITY-BASE-L1-1-0.DLL
API-MS-WIN-SECURITY-CAPABILITY-L1-1-0.DLL
API-MS-WIN-SECURITY-CREDENTIALS-L1-1-0.DLL
API-MS-WIN-SECURITY-CREDENTIALS-L2-1-0.DLL
API-MS-WIN-SECURITY-CRYPTOAPI-L1-1-0.DLL
API-MS-WIN-SECURITY-LSALOOKUP-L1-1-1.DLL
API-MS-WIN-SECURITY-LSALOOKUP-L1-1-2.DLL
API-MS-WIN-SECURITY-LSALOOKUP-L2-1-1.DLL
API-MS-WIN-SECURITY-LSAPOLICY-L1-1-0.DLL
API-MS-WIN-SECURITY-PROVIDER-L1-1-0.DLL
API-MS-WIN-SECURITY-SDDL-L1-1-0.DLL
API-MS-WIN-SECURITY-SDDLPARSECOND-L1-1-0.DLL
API-MS-WIN-SERVICE-WINSVC-L1-1-0.DLL
API-MS-WIN-SHCORE-COMHELPERS-L1-1-0.DLL
API-MS-WIN-SHCORE-OBSOLETE-L1-1-0.DLL
API-MS-WIN-SHCORE-REGISTRY-L1-1-1.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
API-MS-WIN-SHCORE-STREAM-L1-1-0.DLL
API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL
API-MS-WIN-SHCORE-SYSINFO-L1-1-0.DLL
API-MS-WIN-SHCORE-THREAD-L1-1-0.DLL
API-MS-WIN-SHCORE-UNICODEANSI-L1-1-0.DLL
API-MS-WIN-SHELL-SHELLCOM-L1-1-0.DLL
API-MS-WIN-SHELL-SHELLFOLDERS-L1-1-0.DLL
API-MS-WIN-SHLWAPI-IE-L1-1-0.DLL
API-MS-WIN-SHLWAPI-WINRT-STORAGE-L1-1-1.DLL
API-MS-WIN-STORAGE-EXPORTS-EXTERNAL-L1-1-0.DLL
API-MS-WIN-STORAGE-EXPORTS-INTERNAL-L1-1-0.DLL
DEVICELOCKHELPERS.DLL
EMCLIENT.DLL
EXT-MS-MF-PAL-L2-1-0.DLL
EXT-MS-ONECORE-APPCHROMEAPI-L1-1-0.DLL
EXT-MS-ONECORE-APPMODEL-VEVENTDISPATCHER-L1-1-0.DLL
EXT-MS-ONECORE-DCOMP-L1-1-0.DLL
EXT-MS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L
EXT-MS-WIN-SECUR32-TRANSLATENAME-L1-1-0.DLL
EXT-MS-WIN-SECURITY-CAPAUTHZ-L1-1-0.DLL
EXT-MS-WIN-SECURITY-CHAMBERS-L1-1-0.DLL
EXT-MS-WIN-SECURITY-CREDUI-L1-1-0.DLL
EXT-MS-WIN-SECURITY-EFS-L1-1-0.DLL
EXT-MS-WIN-SECURITY-EFSWRT-L1-1-1.DLL
EXT-MS-WIN-SESSION-USERMGR-L1-1-0.DLL
EXT-MS-WIN-SESSION-USERTOKEN-L1-1-0.DLL
EXT-MS-WIN-SESSION-WINSTA-L1-1-0.DLL
EXT-MS-WIN-SESSION-WTSAPI32-L1-1-0.DLL
EXT-MS-WIN-SETUPAPI-INF-L1-1-0.DLL
EXT-MS-WIN-SHELL-DIRECTORY-L1-1-0.DLL
EXT-MS-WIN-SHELL-PROPSYS-L1-1-0.DLL
EXT-MS-WIN-SHELL-SHELL32-L1-2-0.DLL
EXT-MS-WIN-SHELL-SHLWAPI-L1-1-0.DLL
EXT-MS-WIN-SHELL32-SHELLCOM-L1-1-0.DLL
EXT-MS-WIN-SXS-OLEAUTOMATION-L1-1-0.DLL
EXT-MS-WIN-UI-VIEWMANAGEMENT-L1-1-0.DLL
EXT-MS-WIN-USP10-L1-1-0.DLL
EXT-MS-WIN-WER-UI-L1-1-0.DLL
EXT-MS-WIN-WER-XBOX-L1-1-0.DLL
EXT-MS-WIN-WINRT-STORAGE-L1-1-0.DLL
EXT-MS-WIN-WLAN-ONEXUI-L1-1-0.DLL
IESHIMS.DLL

# Found:
c:\windows\system32\IEFRAME.DLL
c:\windows\system32\SHCORE.DLL
c:\windows\system32\SHLWAPI.DLL
c:\windows\system32\ADVAPI32.DLL
c:\windows\system32\GDI32.DLL
c:\windows\system32\IPHLPAPI.DLL
c:\windows\system32\KERNEL32.DLL
c:\windows\system32\KERNELBASE.DLL
c:\windows\system32\MSVCRT.DLL
c:\program files\nodejs\NODE.EXE
c:\windows\system32\NTDLL.DLL
c:\windows\system32\PROFAPI.DLL
c:\windows\system32\PSAPI.DLL
c:\windows\system32\RPCRT4.DLL
c:\windows\system32\SECHOST.DLL
c:\windows\system32\USER32.DLL
c:\windows\system32\USERENV.DLL
c:\git\region-text-classifier\node_modules\webworker-threads\build\release\WEBWORKERTHREADS.NODE
c:\windows\system32\WINMM.DLL
c:\windows\system32\WINMMBASE.DLL
c:\windows\system32\WS2_32.DLL
c:\windows\system32\ACLUI.DLL
c:\windows\system32\ACTIVEDS.DLL
c:\windows\system32\ADSLDPC.DLL
c:\windows\system32\ADVPACK.DLL
c:\windows\system32\APPHELP.DLL
c:\windows\system32\APPREPAPI.DLL
c:\windows\system32\AUTHZ.DLL
c:\windows\system32\BCP47LANGS.DLL
c:\windows\system32\BCRYPT.DLL
c:\windows\system32\BCRYPTPRIMITIVES.DLL
c:\windows\system32\BROWCLI.DLL
c:\windows\system32\CABINET.DLL
c:\windows\system32\CERTCA.DLL
c:\windows\system32\CFGMGR32.DLL
c:\windows\system32\CHARTV.DLL
c:\windows\system32\COMBASE.DLL
c:\windows\winsxs\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.10586.0_none_396e892957c7fb25\COMCTL32.DLL
c:\windows\winsxs\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.10586.839_none_a2ddba30a539a2ae\COMCTL32.DLL
c:\windows\system32\COMDLG32.DLL
c:\windows\system32\COML2.DLL
c:\windows\system32\COREMESSAGING.DLL
c:\windows\system32\COREUICOMPONENTS.DLL
c:\windows\system32\CREDUI.DLL
c:\windows\system32\CRYPT32.DLL
c:\windows\system32\CRYPTBASE.DLL
c:\windows\system32\CRYPTNET.DLL
c:\windows\system32\CRYPTNGC.DLL
c:\windows\system32\CRYPTSP.DLL
c:\windows\system32\CRYPTUI.DLL
c:\windows\system32\CSCAPI.DLL
c:\windows\system32\D2D1.DLL
c:\windows\system32\D3D11.DLL
c:\windows\system32\DAVHLPR.DLL
c:\windows\system32\DBGCORE.DLL
c:\windows\system32\DBGHELP.DLL
c:\windows\system32\DCOMP.DLL
c:\windows\system32\DEVMGR.DLL
c:\windows\system32\DEVOBJ.DLL
c:\windows\system32\DEVRTL.DLL
c:\windows\system32\DFSCLI.DLL
c:\windows\system32\DHCPCSVC.DLL
c:\windows\system32\DHCPCSVC6.DLL
c:\windows\system32\DNSAPI.DLL
c:\windows\system32\DPAPI.DLL
c:\windows\system32\DRVSTORE.DLL
c:\windows\system32\DSPARSE.DLL
c:\windows\system32\DSREG.DLL
c:\windows\system32\DSROLE.DLL
c:\windows\system32\DUI70.DLL
c:\windows\system32\DUSER.DLL
c:\windows\system32\DWMAPI.DLL
c:\windows\system32\DWRITE.DLL
c:\windows\system32\DXGI.DLL
c:\windows\system32\EAPPCFG.DLL
c:\windows\system32\EAPPPRXY.DLL
c:\windows\system32\EDPAUDITAPI.DLL
c:\windows\system32\EDPUTIL.DLL
c:\windows\system32\EFSADU.DLL
c:\windows\system32\EFSUTIL.DLL
c:\windows\system32\EFSWRT.DLL
c:\windows\system32\ELSCORE.DLL
c:\windows\system32\ESENT.DLL
c:\windows\system32\FECLIENT.DLL
c:\windows\system32\FIREWALLAPI.DLL
c:\windows\system32\FLTLIB.DLL
c:\windows\system32\FMS.DLL
c:\windows\system32\FWBASE.DLL
c:\windows\system32\FWPOLICYIOMGR.DLL
c:\windows\winsxs\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.10586.839_none_d3c8ad15ffcc1c7c\GDIPLUS.DLL
c:\windows\system32\HLINK.DLL
c:\windows\system32\IEADVPACK.DLL
c:\windows\system32\IEAPFLTR.DLL
c:\windows\system32\IERTUTIL.DLL
c:\windows\system32\IEUI.DLL
c:\windows\system32\IMAGEHLP.DLL
c:\windows\system32\IMGUTIL.DLL
c:\windows\system32\IMM32.DLL
c:\windows\system32\INETCOMM.DLL
c:\windows\system32\LINKINFO.DLL
c:\windows\system32\LOGONCLI.DLL
c:\windows\system32\MFC42U.DLL
c:\windows\system32\MLANG.DLL
c:\windows\system32\MMDEVAPI.DLL
c:\windows\system32\MPR.DLL
c:\windows\system32\MPRMSG.DLL
c:\windows\system32\MRMCORER.DLL
c:\windows\system32\MSASN1.DLL
c:\windows\system32\MSCTF.DLL
c:\windows\system32\MSFEEDS.DLL
c:\windows\system32\MSHTML.DLL
c:\windows\system32\MSI.DLL
c:\windows\system32\MSILTCFG.DLL
c:\windows\system32\MSIMG32.DLL
c:\windows\system32\MSLS31.DLL
c:\windows\system32\MSOERT2.DLL
c:\windows\system32\MSVCP110_WIN.DLL
c:\windows\system32\MSVCP_WIN.DLL
c:\windows\system32\NCAAPI.DLL
c:\windows\system32\NCRYPT.DLL
c:\windows\system32\NETAPI32.DLL
c:\windows\system32\NETUTILS.DLL
c:\windows\system32\NEWDEV.DLL
c:\windows\system32\NSI.DLL
c:\windows\system32\NTASN1.DLL
c:\windows\system32\NTDSAPI.DLL
c:\windows\system32\NTSHRUI.DLL
c:\windows\system32\OCCACHE.DLL
c:\windows\system32\ODBC32.DLL
c:\windows\system32\OLE32.DLL
c:\windows\system32\OLEACC.DLL
c:\windows\system32\OLEAUT32.DLL
c:\windows\system32\OLEDLG.DLL
c:\windows\system32\ONEX.DLL
c:\windows\system32\POLICYMANAGER.DLL
c:\windows\system32\POWRPROF.DLL
c:\windows\system32\PRINTUI.DLL
c:\windows\system32\PRNTVPT.DLL
c:\windows\system32\PROPSYS.DLL
c:\windows\system32\PUIAPI.DLL
c:\windows\system32\RASAPI32.DLL
c:\windows\system32\RASMAN.DLL
c:\windows\system32\REGAPI.DLL
c:\windows\system32\RSTRTMGR.DLL
c:\windows\system32\RTUTILS.DLL
c:\windows\system32\SAMCLI.DLL
c:\windows\system32\SAMLIB.DLL
c:\windows\system32\SCECLI.DLL
c:\windows\system32\SECUR32.DLL
c:\windows\system32\SETTINGSYNCPOLICY.DLL
c:\windows\system32\SETUPAPI.DLL
c:\windows\system32\SHDOCVW.DLL
c:\windows\system32\SHELL32.DLL
c:\windows\system32\SLC.DLL
c:\windows\system32\SPFILEQ.DLL
c:\windows\system32\SPINF.DLL
c:\windows\system32\SPPC.DLL
c:\windows\system32\SRPAPI.DLL
c:\windows\system32\SRVCLI.DLL
c:\windows\system32\SSPICLI.DLL
c:\windows\system32\TAPI32.DLL
c:\windows\system32\TBS.DLL
c:\windows\system32\TDH.DLL
c:\windows\system32\TWINAPI.APPCORE.DLL
c:\windows\system32\TWINAPI.DLL
c:\windows\system32\UIAUTOMATIONCORE.DLL
c:\windows\system32\URLMON.DLL
c:\windows\system32\UXTHEME.DLL
c:\windows\system32\VAULTCLI.DLL
c:\windows\system32\VERSION.DLL
c:\windows\system32\VIRTDISK.DLL
c:\windows\system32\W32TOPL.DLL
c:\windows\system32\WEBIO.DLL
c:\windows\system32\WEBSERVICES.DLL
c:\windows\system32\WEBSOCKET.DLL
c:\windows\system32\WER.DLL
c:\windows\system32\WEVTAPI.DLL
c:\windows\system32\WINBRAND.DLL
c:\windows\system32\WINDOWSCODECS.DLL
c:\windows\system32\WINHTTP.DLL
c:\windows\system32\WININET.DLL
c:\windows\system32\WINNSI.DLL
c:\windows\system32\WINSCARD.DLL
c:\windows\system32\WINSPOOL.DRV
c:\windows\system32\WINSTA.DLL
c:\windows\system32\WINTRUST.DLL
c:\windows\system32\WKSCLI.DLL
c:\windows\system32\WLANAPI.DLL
c:\windows\system32\WLDAP32.DLL
c:\windows\system32\WMICLNT.DLL
c:\windows\system32\WPCWEBFILTER.DLL
c:\windows\system32\WTSAPI32.DLL
c:\windows\system32\XMLLITE.DLL

@matheussampaio
Copy link

matheussampaio commented Jul 26, 2017

I'm having a similar problem, but with edge-js:

pkg/prelude/bootstrap.js:1102
      throw error;
      ^
 
Error: Module did not self-register.
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at Module.require (pkg/prelude/bootstrap.js:1083:31)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\snapshot\monitor-service\node_modules\edge-js\lib\edge.js:0:0)
    at Module._compile (pkg/prelude/bootstrap.js:1173:22)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at Module.require (pkg/prelude/bootstrap.js:1083:31)
    at require (internal/module.js:11:18)

Versions:

edge-js: v8.1.3
node: v8.2.1
pkg: v4.1.3
pkg-fetch: v2.3.7

Did you solve this issue @igorklopov ?

@mike-eason
Copy link

Same problem here with edge-js.

@Omar1123
Copy link

Same problem with edge-js, do you know how to solve it?

@am-oc
Copy link

am-oc commented Nov 15, 2017

I am also having the same problem with edge-js. Am currently trying to debug, but havent made much progress. Do you know how to solve it?

@Lidanha
Copy link

Lidanha commented Feb 27, 2018

Hey, anyone able to solve it? I have the same issue with edge-js

@ArosPrince
Copy link

Same issue with fastcall.

@malexindigo
Copy link

I have the same problem with edge-js, could anyone solve it?

@veraw
Copy link

veraw commented Jun 3, 2018

I am also having the same issue with edge-js, really need to find a resolution.

@ArosPrince
Copy link

ArosPrince commented Jun 4, 2018

OK, it's kind of funny but for us the solution was to rename the generated executable to node.exe. The inspiration comes from here. See "Native modules".

It might be a good idea to either solve it or at least mention it in the documentation.

@mreis1
Copy link

mreis1 commented Jun 28, 2018

@ArosPrince that's weird but the truth is this solves the issue.

@entozoon
Copy link

Is there a workaround for this, with native modules?

Kinda dumb having to name a released binary as node.exe ..

@lusentis
Copy link

lusentis commented Aug 15, 2018

it's kind of funny but for us, the solution was to rename the generated executable to node.exe.

This solution worked, but it was really annoying.
I have tried to fix this today after I noticed that this error occurred only with one specific native module, and not with any other.

I have followed these steps:

  1. cloned the GIT repository of the module that's not working, so I could modify some files and rebuild it
  2. updated node-gyp, $ npm i -g node-gyp@latest
  3. cleaned up the binding.gyp file in the repository and just keep the essential stuff, something like:
            "target_name": "mymodule",
            "sources": [
                "yourfile.cc"
            ],
            "include_dirs": [
                "<!(node -e \"require('nan')\")"
            ],
  1. rebuilt the native module with node-gyp configure && node-gyp rebuild

After following these steps, the error above went away, and I can rename the executable any way I wish.

Unfortunately, I'm not sure which step fixed what and can't look at it right now.

$ node --version
v10.8.0
$ pkg --version
4.3.4
$ node-gyp --version
v3.8.0

@seiyria
Copy link

seiyria commented Feb 9, 2019

I'm also having some trouble with using edge-js (the new version of edge):

Error: Cannot find module 'D:\snapshot\proj\node_modules\edge-js\lib\native\win32\x64\10.14.0\edge_nativeclr'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:592:15)
    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1280:46)
    at Function.Module._load (internal/modules/cjs/loader.js:518:25)
    at Module.require (internal/modules/cjs/loader.js:648:17)
    at Module.require (pkg/prelude/bootstrap.js:1159:31)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (D:\snapshot\soanamnesis-autoplay\node_modules\edge-js\lib\edge.js:55:8)
    at Module._compile (pkg/prelude/bootstrap.js:1254:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
    at Module.load (internal/modules/cjs/loader.js:610:32)

Is it related to this error? This is the only thread that I can find about using edge-js and pkg together.

@poseidonCore
Copy link

@seiyria: I have exactly the same kind error and I initially resolved it by using an extremely janky approach of including the entire set of node module files

{
...
  "pkg": { 
    "assets": [
      "app/node_modules/edge-js/**/*",
      "app/node_modules/edge-cs/**/*"
    ]
  },
...
}

Which will give warnings like this when packaging the application:

Warning Cannot include addon %1 into executable.
  The addon must be distributed with executable as %2.
  C:\...\node_modules\edge-js\lib\native\win32\x64\10.14.0\edge_coreclr.node
  path-to-executable/edge_coreclr.node

And so following this, I included the entire contents of the folder for the version of node that I was using (win32\x64\10.14.0) in the output folder for the packaged application.

This then allowed me to package and run the application ... but when the actual time came to use the edge-js functionality in the application, it resulted in

ERROR] (node:11484) UnhandledPromiseRejectionWarning: Error: Could not load file or assembly 
'file:///C:\snapshot\Package\...\Services\ReportsService\Documenter\Documenter.dll' 
or one of its dependencies. The system cannot find the file specified.
    at Object.exports.func (C:\snapshot\Package\...\node_modules\edge-js\lib\edge.js:180:17)
    at Promise (C:\snapshot\Package\...\Services\ReportsService.js:24:32)
    at new Promise (<anonymous>)
    at Object.callDocumenter (C:\snapshot\Package\...\Services\ReportsService.js:21:16)
    at Promise (C:\snapshot\Package\...\Services\ReportsService\createPDF.js:26:64)
    at new Promise (<anonymous>)
    at Object.createPDF (C:\snapshot\Package\...\Services\ReportsService\createPDF.js:7:12)
    at createDocument (C:\snapshot\Package\...\Services\ReportsService\indexReport.js:481:41)

Which gives me the impression that the virtual file system of the packaged application then becomes a follow-on issue even when this is resolved (jankily).

This remained true even if I explicitly included all of the libraries that the .Net program needed (here called Documenter).

I'll post any solution that I find, but I don't expect one soon.

@seiyria
Copy link

seiyria commented Feb 11, 2019

@poseidonCore Thanks for the follow-up. That was going to be what I tried next. I've made a post on reddit to see if there are any other solutions that might work, or if anyone has run into this and successfully solved it before. I'll let you know if I manage to get it working.

@lusentis
Copy link

lusentis commented Feb 11, 2019

@seiyria @poseidonCore

Eventually, we solved the issue by manually patching the .node library using rid.exe

Then, copy the patched mymodule.node right next to myapp.exe, as usual.
This solution is working without any issue so far, tested with ffi and fastcall - edge should be no different.

My initial approach was to manually patch the .dll using an hex editor. That worked but only if my app's executable name had the same length as node (myap.exe worked, myapp.exe didn't), kinda makes sense.

@seiyria
Copy link

seiyria commented Feb 11, 2019

@lusentis So with this approach, you have to patch the (in this case) edge_nativeclr.node file, then put it next to the built exe with pkg? So you'll have a folder with an exe and a few .node files?

Hmm, I saw pkg outputting something about that, but I figured when it built my exe it would put the related .node files next to it on its own.

@lusentis
Copy link

lusentis commented Feb 11, 2019

Correct.

The dist folder should then contain:

  • the myapp.exe file
  • the .node files

In my app's repository, I keep the patched .node files in a separate folder, and copy them with a bash script next to the .exe file as part of the build process.

I figured when it built my exe it would put the related .node files next to it on its own

afaik it only outputs this warning, without actually copying the files.

@seiyria
Copy link

seiyria commented Feb 11, 2019

So, here's a problem I'm having. It seems to work with first-level native dependencies, but not second-level. For example, I have a library that imports edge-js, and I import that library. pkg reports that it tries to stuff it into the exe, but then I get:

pkg/prelude/bootstrap.js:1178
      throw error;
      ^
Error: Could not load file or assembly 'file:///D:\snapshot\proj\node_modules\edge-cs\lib\edge-cs.dll' or one of its dependencies. The system cannot find the file specified.
    at Object.exports.func (D:\snapshot\proj\node_modules\edge-js\lib\edge.js:180:17)
    at Object.<anonymous> (D:\snapshot\proj\node_modules\winpos\index.js:5:23)
    at Module._compile (pkg/prelude/bootstrap.js:1254:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
    at Module.load (internal/modules/cjs/loader.js:610:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:549:12)
    at Function.Module._load (internal/modules/cjs/loader.js:541:3)
    at Module.require (internal/modules/cjs/loader.js:648:17)
    at Module.require (pkg/prelude/bootstrap.js:1159:31)
    at require (internal/modules/cjs/helpers.js:20:18)

I'll try bringing in edge-js and the deps directly, but I'm worried it still won't work because those have csharp files in them.

@lusentis
Copy link

lusentis commented Feb 11, 2019

This is probably related to how edge-cs requires the DLL. If you look at how the DLL is required, edge-cs uses an absolute path, resolved using __dirname: https://github.com/tjanczuk/edge-cs/blob/master/lib/edge-cs.js#L4, which will not work as expected once the app is packaged because pkg sets its own __dirname

Try one of the following:

  1. either set process.env.EDGE_USE_CORECLR = true
  2. or, copy edge-cs.dll next to your exe, and set process.env.EDGE_CS_NATIVE = "./edge-cs.dll"
  3. or, include just the node_modules\edge-cs\lib\edge-cs.dll file as a pkg asset, keeping the folder structure

@seiyria
Copy link

seiyria commented Feb 11, 2019

Holy shit, that's a lot of progress. For reference, I was able to make it work by using a bootstrap script that did this:

process.env.EDGE_CS_NATIVE='./edge-cs.dll';
require('./src/index');

I also have a post-build script that copies files:

const fs = require('fs');

fs.copyFileSync('./src/ext/rectshot.cs', './build/rectshot.cs');
fs.copyFileSync('./src/ext/winpos.cs', './build/winpos.cs');
fs.copyFileSync('./node_modules/edge-cs/lib/edge-cs.dll', './build/edge-cs.dll');
fs.copyFileSync('./node_modules/robotjs/build/Release/robotjs.node', './build/robotjs.node');

It seems it does not like the .cs files being embedded, so my resolution is to release them alongside the app and do this:

const basepath = process.pkg ? process.cwd() : __dirname + '/ext';

// native deps
const winpos = edge.func(path.join(basepath, 'winpos.cs'));
const rectshot = edge.func(path.join(basepath, 'rectshot.cs'));

I'm not out of the woods yet, I get a new error now:

pkg/prelude/bootstrap.js:1178
      throw error;
      ^

TypeError: undefined is not a function
    at Object.<anonymous> (D:\snapshot\proj\src\index.js:0:0)
    at Module._compile (pkg/prelude/bootstrap.js:1254:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
    at Module.load (internal/modules/cjs/loader.js:610:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:549:12)
    at Function.Module._load (internal/modules/cjs/loader.js:541:3)
    at Module.require (internal/modules/cjs/loader.js:648:17)
    at Module.require (pkg/prelude/bootstrap.js:1159:31)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (D:\snapshot\proj\build.js:0:0)

but that's progress - my app does spit out some messages when it starts up, so tracking it down from here should (hopefully) be trivial.

Thanks a ton @lusentis!

I still haven't gotten rid.exe to work just yet, but that's for after I get the entire thing working correctly.

[edit]
Looks like my error is with doing process.stdin.setRawMode - I can work around this and find an alternative. It all works now, which is exciting.

@poseidonCore
Copy link

@lusentis: Thanks for all the guidance. It looks like this resolved more easily for me than others.

Following your advice, I just had to

  1. dump all of the relevant .dll, .exe and .node files and any other relevant ,NET resources into the same folder as the pkg output .exe file;
  2. set the pkg output file to be node.exe (rather than something more meaningful); and
  3. reference the edge-js modules as assets (which could really be slimmed down as you mentioned):
{
...
  "pkg": { 
    "assets": [
      "app/node_modules/edge-js/**/*",
      "app/node_modules/edge-cs/**/*"
    ]
  },
...
}

The whole application runs fine for me without having to edit dlls/exes or use EDGE_CS_NATIVE. Luckily, because I go on to install this as a service using nssm.exe, the issue of having a genericly named output file was an acceptable compromise given that I can customise the service name.

For anyone visiting this issue, the main problem is that all the errors are of confusing origin and get into a jumble. I believe that there is a combination of issues here at play that have to do with

  1. edge-js not natively working properly with an output file named other than node.exe;
  2. edge-js getting lost in the virtual file system of pkg; and
  3. the .NET application not being able to operate within that virtual file system because of its read-only nature (eg scratch spaces and log files needed to be redirected outside of the virtual file system).

However ... I can imagine that for people with more complicated apps that use .NET resources with conflicting names, this will start to look like dll hell.

@kanso-git
Copy link

Holy shit, that's a lot of progress. For reference, I was able to make it work by using a bootstrap script that did this:

process.env.EDGE_CS_NATIVE='./edge-cs.dll';
require('./src/index');

I also have a post-build script that copies files:

const fs = require('fs');

fs.copyFileSync('./src/ext/rectshot.cs', './build/rectshot.cs');
fs.copyFileSync('./src/ext/winpos.cs', './build/winpos.cs');
fs.copyFileSync('./node_modules/edge-cs/lib/edge-cs.dll', './build/edge-cs.dll');
fs.copyFileSync('./node_modules/robotjs/build/Release/robotjs.node', './build/robotjs.node');

It seems it does not like the .cs files being embedded, so my resolution is to release them alongside the app and do this:

const basepath = process.pkg ? process.cwd() : __dirname + '/ext';

// native deps
const winpos = edge.func(path.join(basepath, 'winpos.cs'));
const rectshot = edge.func(path.join(basepath, 'rectshot.cs'));

I'm not out of the woods yet, I get a new error now:

pkg/prelude/bootstrap.js:1178
      throw error;
      ^

TypeError: undefined is not a function
    at Object.<anonymous> (D:\snapshot\proj\src\index.js:0:0)
    at Module._compile (pkg/prelude/bootstrap.js:1254:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
    at Module.load (internal/modules/cjs/loader.js:610:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:549:12)
    at Function.Module._load (internal/modules/cjs/loader.js:541:3)
    at Module.require (internal/modules/cjs/loader.js:648:17)
    at Module.require (pkg/prelude/bootstrap.js:1159:31)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (D:\snapshot\proj\build.js:0:0)

but that's progress - my app does spit out some messages when it starts up, so tracking it down from here should (hopefully) be trivial.

Thanks a ton @lusentis!

I still haven't gotten rid.exe to work just yet, but that's for after I get the entire thing working correctly.

[edit]
Looks like my error is with doing process.stdin.setRawMode - I can work around this and find an alternative. It all works now, which is exciting.

@seiyria could you please share the project where you have configured edge-js to work with pkg?
many thanks in advance

@yashodhah
Copy link

After renaming the executable to node.exe
(node:18056) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): System.IO.FileNotFoundException: Could not load file or assembly 'file:///D:\snapshot\LinkToExcellIssue\node_modules\edge-cs\lib\edge-cs.dll' or one of its dependencies. The system cannot find the file specified.

Before renaming
(node:12648) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Module did not self-register.

@kanso-git
Copy link

@YD1722 are you using a precompiled version of edge ? like edge-js

@yashodhah
Copy link

yashodhah commented Sep 25, 2019

@YD1722 are you using a precompiled version of edge ? like edge-js

Yes.
I am using this module https://www.npmjs.com/package/node-dde-with-edge-js.

@mrthebunny
Copy link

Hi everyone,

I stumbled on this exact problem with my native C++ addon. Both the workaround of renaming my packaged executable to node.exe and using rid.exe to patch the library worked.

After more searching, I found the source of the issue (in my project at least) in the doc for Electron.

Turns out my bindings.gyp file had win_delay_load_hook set to false. Switching it to true solved my issue. My native addon now works correctly with both node.exe and my packaged executable.

{ "targets": [ { "target_name": "tools", "win_delay_load_hook": "true",

cf https://electronjs.org/docs/tutorial/using-native-node-modules

"If you get an error like Module did not self-register, or The specified procedure could not be found, it may mean that the module you're trying to use did not correctly include the delay-load hook. If the module is built with node-gyp, ensure that the win_delay_load_hook variable is set to true in the binding.gyp file, and isn't getting overridden anywhere. If the module is built with another system, you'll need to ensure that you build with a delay-load hook installed in the main .node file. Your link.exe invocation should look like this:"

@urdeveloper
Copy link

@mrthebunny , Thank you very much for sharing your solution.

I'm using edge-js and had the same error "Error: Module did not self-register".

Once I changed the binding settings win_delay_load_hook to true in node_modules/edge-js/binding.gyp and rebuilt it, it started to work.

I didn't rename my packaged executable to node.exe nor used rid.exe. I also didn't change pkg configuration to include the assets under edge-js and edge-cs.

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

@github-actions github-actions bot added the Stale label May 10, 2021
@github-actions
Copy link

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

@Vishmatha7
Copy link

I am using node-dde-with-edge-js module. For this i have to use edge-js as a dependency. with this comes the issue .
Module did not self-register: '\?\C:\Program Files............\edge_nativeclr.node'. I am trying with node 16.16.0 and already built https://github.com/agracio/edge-js in 16.16.0.

tried win_delay_load_hook = true and it also did not worked.

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

No branches or pull requests