vercel / pkg

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

copyFolderRecursiveSync exits early while copying files from node_modules #1967

Closed jackkav closed 10 months ago

jackkav commented 1 year ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

18.15.0

What operating system are you using?

macOS

What CPU architecture are you using?

x86_64

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

node18-linux-x64

Describe the Bug

While maintaining insomnia, and packaging a native binary node_module node-libcurl after bumping pkg from 5.1.2 to 5.8.1 I noticed the UNEXPECTED-15 error, after some debugging determined it was because the .node file had not been copied into the temp folder during packaging.

I stepped through the code and determined copyFolderRecursiveSync was being called for each directory and file in the node-libcurl folder but when it would get to the nested module at node_modules/node-libcurl/node_modules/tslib/* it would skip further copy actions without warning (skipping over the .node). I was able to prove this by installing a matching version of tslib in the parent project so that tslib would be hoisted and it resolved the issue. More info in #205

Expected Behavior

should fail loudly if there is a copy issue

To Reproduce

install the latest tslib and node-libcurl packages to an npm project in order to cause it not to hoist, then include node-libcurl in the index.js and try to run pkg.

robertsLando commented 1 year ago

Would you open a PR to fix this?

github-actions[bot] commented 10 months ago

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] commented 10 months ago

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