vercel/pkg

copyFolderRecursiveSync exits early while copying files from node_modules

jackkav opened this issue · 3 comments

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.

Would you open a PR to fix this?

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

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