vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.28k stars 1.01k forks source link

Error: The specified module could not be found (External DLLs) #2038

Closed 4piu closed 8 months ago

4piu commented 8 months ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

18.19.0

What operating system are you using?

Windows

What CPU architecture are you using?

x86_64

What Node versions, OSs and CPU architectures are you building for?

win-x64

Describe the Bug

I am having trouble build and run a project that uses vigemclient.

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

Error: The specified module could not be found.
C:\Users\xyz\AppData\Local\Temp\pkg\dffb76492e2b5438facb6abd07322a39427b6471a6eef1eb498d361e2d664f5a\vigemclient\build\Release\vigemclient.node
    at process.dlopen (pkg/prelude/bootstrap.js:2251:28)
    at Module._extensions..node (node:internal/modules/cjs/loader:1196:18)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\snapshot\MyProj\node_modules\vigemclient\lib\ViGEmClient.js:1:83)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v18.5.0

In the <temp_path>\vigemclient\build\Release folder, there's only a single vigemclient.node file, where its dependency files (.dll, etc.) are missing. If I copy the required file manually from node_modules to the temp folder, the program runs without issue.

Expected Behavior

Would like to know how I can configure the pkg so it leave some node_modules untouched. Or is it possible it can sort out these external dependencies.

To Reproduce

const ViGEmClient = require('vigemclient');