pkg icon indicating copy to clipboard operation
pkg copied to clipboard

package with .node not working

Open cheul123a opened this issue 3 years ago • 11 comments

when i pkg my project that use robotjs and opencv4nodejs this message comes out and exe not throw error. any one know how to solve this?

when pkg -d `

[debug] prebuild-install failed[C:\Users\MinkyuKim\Desktop\project\template_match_test\node_modules\robotjs\build\Release\robotjs.node]: spawnSync C:\Users\MinkyuKim\Desktop\project\template_match_test\node_modules\pkg\node_modules.bin\prebuild-install ENOENT [debug] prebuild-install failed[C:\Users\MinkyuKim\Desktop\project\template_match_test\node_modules\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.node]: spawnSync C:\Users\MinkyuKim\Desktop\project\template_match_test\node_modules\pkg\node_modules.bin\prebuild-install ENOENT `

when execute exe file ` Error: The specified module could not be found. C:\Users\MINKYU~1\AppData\Local\Temp\pkg\93dbf0b51154096661d2ec65984eaa3f324401115e046c86582f863f538cb404\opencv4nodejs-prebuilt\build\Release\opencv4nodejs.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 Object. (C:\snapshot\template_match_test\node_modules\opencv4nodejs-prebuilt\lib\cv.js:11:8) at Module._compile (pkg/prelude/bootstrap.js:1794:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) { code: 'ERR_DLOPEN_FAILED' }

cheul123a avatar Jan 12 '22 19:01 cheul123a

Try to add that .node file to assets

robertsLando avatar Jan 13 '22 07:01 robertsLando

Is your problem solved yet ? Because I encounter a same problem

FahrulID avatar Jan 14 '22 15:01 FahrulID

I tested with assets with same issue. Also tested require.js file has similar issue. Pkg executable has the require statement as text but it isn't resolved at runtime. Reverted to pkg 5.5.1 and the issue does not exist.

Deathmetal007 avatar Jan 19 '22 21:01 Deathmetal007

Perhaps the platform specific bindings aren't getting included the the packaged binary. One workaround I came across was simply putting them in the root directory of the executable. Does that solve the issue?


From: Deathmetal007 @.> Sent: Thursday, January 20, 2022 3:04 AM To: vercel/pkg @.> Cc: Subscribed @.***> Subject: Re: [vercel/pkg] package with .node not working (Issue #1477)

I tested with assets with same issue. Also tested require.js file has similar issue. Pkg executable has the require statement as text but it isn't resolved at runtime. Reverted to pkg 5.5.1 and the issue does not exist.

— Reply to this email directly, view it on GitHubhttps://github.com/vercel/pkg/issues/1477#issuecomment-1016877686, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHGCLB3YNPE5EQYMSLKSTKLUW4THHANCNFSM5LZ3HBZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.Message ID: @.***>

coderkoala avatar Jan 20 '22 11:01 coderkoala

The workaround is valid at any location if the require to the node addon is not nested, i.e. using a require to an export does not work. I use a direct path for zeromq for example require('node_modules/addons/zmq.node') in the zeromq binding.js instead of require('addons/zmq.node')

Deathmetal007 avatar Jan 20 '22 18:01 Deathmetal007

This has already been fixed at https://github.com/vercel/pkg/blob/edfcc7b139d667d6be0e46f4101e917ca9c154bd/prelude/bootstrap.js#L2197 but somehow isn't included in 5.5.2. The workaround is to have a node_modules in the path, otherwise nothing is copied.

Mwni avatar Mar 31 '22 01:03 Mwni

see this https://github.com/vercel/pkg/discussions/1623#discussioncomment-2729625 @FahrulID @cheul123a

lancety avatar May 11 '22 12:05 lancety

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[bot] avatar Aug 10 '22 00:08 github-actions[bot]

Has it been resolved?

rajibchy avatar Aug 10 '22 06:08 rajibchy

This is not really an issue, more like a user configuration error. I'm using pkg with really complex projects and I never had modules issues when I correctly add them to assets as described in docs

robertsLando avatar Aug 10 '22 07:08 robertsLando

@robertsLando Thanks for your suggestion. require(some_variable) which are not working inside node_modules. I've configured pkg.scripts at package.json. Whatever, I solved this issue myself.

rajibchy avatar Aug 10 '22 14:08 rajibchy

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[bot] avatar Nov 09 '22 00:11 github-actions[bot]

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

github-actions[bot] avatar Nov 15 '22 00:11 github-actions[bot]