Closed winjeysong closed 2 months ago
add missing lib to assets
assets
already set in package.json
, but useless... ðŸ˜
Try with node_modules/canvas/**/*
Try with
node_modules/canvas/**/*
still error...
It seems pkg
only copies canvas.node
to cache dir, but ignores all other .dylib
files
The code that handles the copy of that folder is this: https://github.com/yao-pkg/pkg/blob/main/prelude/bootstrap.js#L2199
Try to debug it yourself (maybe better if you create a minimal repo that only imports canvas) and then open a PR
You can also try to package your applicaiton with --debug
flag and then run it with DEBUG_PKG=2
env var to see what's inside the snapshot. See docs here: https://github.com/yao-pkg/pkg?tab=readme-ov-file#debug
Thank you for your rapid response. I'm debugging now, and I'll open a PR asap.
After debugging, I find that running pkg src/index.js --output dist/bin --targets node18-macos-x64 --compress GZip
will not include packageJSON.pkg
config.
And I reread the doc carefully, It says:
Just be sure to call pkg package.json or pkg . to make use of package.json configuration.
I changed package.json
and it works now.
It would be nice if the packageJSON.pkg
config merges with command line config.
Would you like to submit a PR? Glad you fixed your issue anyway :)
Would you like to submit a PR? Glad you fixed your issue anyway :)
Sure, I will open a PR later 😄
What version of pkg are you using?
5.12.0
What version of Node.js are you using?
18.0.0
What operating system are you using?
macOS
What CPU architecture are you using?
Apple M1
What Node versions, OSs and CPU architectures are you building for?
node18-macos-x64
Describe the Bug
Thanks for maintaining this project! I got a problem when making executable with
canvas
:I found a related issue: https://github.com/vercel/pkg/issues/1135, but it seems still not fixed on macos...
Expected Behavior
make executable with
canvas
To Reproduce
reproduce repo here: https://github.com/winjeysong/pkg-canvas-test. after cloning, run scripts below and you will see the error message I've mentioned above.