UNEXPECTED-20 with chalk as single dep #151
-
Only chalk as dependency because I had problems in a project with that packaging with pkg so I am isolating it here. package.json {
"name": "chalk",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"type": "commonjs",
"main": "chalk-test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"chalk": "^4.1.2"
}
} Sample script, chalk-test.js import chalk from 'chalk';
const log = console.log;
// Combine styled and normal strings
log(chalk.blue('Hello') + ' World' + chalk.red('!')); Package: $ npx pkg -t node22-linux-x64 chalk-test.js -o chalk-test
> pkg@6.4.0
(node:3857444) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
> Warning Failed to make bytecode node22-x64 for file /snapshot/chalk/chalk-test.js Run: $ ./chalk-test
pkg/prelude/bootstrap.js:438
if (error) throw error;
^
Error: UNEXPECTED-20
at readFileFromSnapshot (pkg/prelude/bootstrap.js:1070:16)
at Object.readFileSync (pkg/prelude/bootstrap.js:1094:18)
at loadSource (node:internal/modules/cjs/loader:1585:17)
at Object..js (node:internal/modules/cjs/loader:1704:44)
at Module.load (node:internal/modules/cjs/loader:1293:32)
at Function._load (node:internal/modules/cjs/loader:1112:12)
at Function.runMain (pkg/prelude/bootstrap.js:1987:12)
at node:internal/main/run_main_module:36:49
Node.js v22.14.0 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Seems that error comes from: Line 1069 in 39ebaec But sincerely I have no clue why that could happen, could you debug please? Please share pkg command output with |
Beta Was this translation helpful? Give feedback.
-
Sry for the late reply =) pkg log:
Result with DEBUG_PKG=2
|
Beta Was this translation helpful? Give feedback.
LOL I totally missed this from your logs:
See #16