Segmentation Fault 11 when packaging consola with Vercel pkg
slowkoder opened this issue · comments
slowkoder commented
Environment
- Node 16.20.2
- NPM 8.19.4
- Consola 3.2.3
- Vercel pkg 5.8.0
- MacOS 10.13.6
Reproduction
- Install pkg and consola NPM packages
- Create JS file with the following:
// index.cjs
const {consola} = require('consola');
consola.info('This is info!');
- Package into CLI executable using pkg
# Via terminal
npx pkg "./index.cjs" -t "node16-macos" -o app
- Run the application
./app
- Error is displayed
Segmentation fault: 11
Describe the bug
When trying to package consola using vercel pkg I get the following error:
Segmentation fault: 11
See Reproduction for steps to replicate
Additional context
No response
Logs
No response
Nils K commented
I fell into this rabbit hole today. If vercel happens to compile their nodejs runtime with --with-intl=small-icu
then this might actually be a bug in nodejs itself which I just filed: nodejs/node#51752
This package could implement a workaround but I do not know of a good method to correctly test the level of ICU support, and if there were, it should likely be implemented in string-width
itself so that everyone benefits.