vercel / pkg

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

Error; code: 'ERR_DLOPEN_FAILED' #1448

Closed s-a closed 2 years ago

s-a commented 2 years ago

What version of pkg are you using?

5.5.1

What version of Node.js are you using?

v14.18.2

What operating system are you using?

Windows

What CPU architecture are you using?

x64

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

default

Describe the Bug

When I start the compiled executable if get the following error message.

Error: Das angegebene Modul wurde nicht gefunden.
C:\Users\........\AppData\Local\Temp\pkg\e5b81aeed8c79d8a659f81d713e5d9950e1735f867061a91d035fed0cf68ddb6\native-reg\binding\prebuilds\win32-x64\node.napi.node
    at process.dlopen (pkg/prelude/bootstrap.js:2114:28)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Module.require (pkg/prelude/bootstrap.js:1719:31)
    at require (internal/modules/cjs/helpers.js:93:18)
    at load (C:\snapshot\pos-kit-version-manager\node_modules\node-gyp-build\index.js:21:10)
    at Object.<anonymous> (C:\snapshot\pos-kit-version-manager\node_modules\native-reg\lib\index.js:12:52)
    at Module._compile (pkg/prelude/bootstrap.js:1794:22) {
  code: 'ERR_DLOPEN_FAILED'
}

I recently upgraded nodejs from 12 to 14. This worked before in node 12 and currently in node 14 when I start the app with node without executable container. I also tried to compile with node12-x64 but this leads also to the same errror.

Expected Behavior

The error should not occur

To Reproduce

Make use of a native module (native-reg). Compile and execute.

JosephJamesCoop commented 2 years ago

I recently switched to a new computer and it was giving me the same error 'ERR_DLOPEN_FAILED'. I traced to error line to a file in my node_modules folder, so I deleted my node_modules file then reran $ npm i That seemed to fix the issue for me. Probably some type of verbiage or syntax it doesn't like in one of your packages for nodejs 14 that was standard in nodejs 12.

d0ma1nn commented 2 years ago

I've reinstalled node, npm package and in package.json changed script typed npm start dev and it worked, dont know why and dont know how.

dipto-roy1245 commented 2 years ago

I've reinstalled node, npm package and in package.json changed script typed npm start dev and it worked, dont know why and dont know how.

can you explain it ?

jcod3s commented 1 year ago

I recently switched to a new computer and it was giving me the same error 'ERR_DLOPEN_FAILED'. I traced to error line to a file in my node_modules folder, so I deleted my node_modules file then reran $ npm i That seemed to fix the issue for me. Probably some type of verbiage or syntax it doesn't like in one of your packages for nodejs 14 that was standard in nodejs 12.

This ended up working for me as well. Thank you!

malindupasan commented 11 months ago

Just delete node_modules and run npm i , it will resolve the issue