unjs / consola

🐨 Elegant Console Logger for Node.js and Browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation Fault 11 when packaging consola with Vercel pkg

slowkoder opened this issue · comments

Environment

  • Node 16.20.2
  • NPM 8.19.4
  • Consola 3.2.3
  • Vercel pkg 5.8.0
  • MacOS 10.13.6

Reproduction

  1. Install pkg and consola NPM packages
  2. Create JS file with the following:
// index.cjs
const {consola} = require('consola');
consola.info('This is info!');
  1. Package into CLI executable using pkg
# Via terminal
npx pkg "./index.cjs" -t "node16-macos" -o app
  1. Run the application
./app
  1. 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

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.