unjs / consola

🐨 Elegant Console Logger for Node.js and Browser
Other
6.12k stars 175 forks source link

FATAL Intl.Segmenter is not a constructor with Node 14 #204

Closed dockleryxk closed 1 year ago

dockleryxk commented 1 year ago

Environment

Node 14.12.4, trying to build a Nuxt 2 project

Reproduction

Unfortunately, this is a private repo

Describe the bug

Build a Nuxt 2 project on Node 14 using consola v3.2.x – get this fatal error.

If I can provide more context, please let me know, but this seems cut and dry.

I did not try other Node versions

Additional context

When forcing consola v3.1.x, there is no issue

Logs

12:48:36
   FATAL  Intl.Segmenter is not a constructor
12:48:36

12:48:36
    at stringWidth (node_modules/@nuxt/cli/node_modules/consola/dist/shared/consola.2a3942ff.cjs:464:37)
12:48:36
    at FancyReporter.formatLogObj (node_modules/@nuxt/cli/node_modules/consola/dist/shared/consola.2a3942ff.cjs:585:41)
12:48:36
    at FancyReporter.log (node_modules/@nuxt/cli/node_modules/consola/dist/shared/consola.deac7d5a.cjs:53:23)
12:48:36
    at Consola._log (node_modules/@nuxt/cli/node_modules/consola/dist/core.cjs:383:16)
12:48:36
    at resolveLog (node_modules/@nuxt/cli/node_modules/consola/dist/core.cjs:351:14)
12:48:36
    at Consola._logFn (node_modules/@nuxt/cli/node_modules/consola/dist/core.cjs:379:5)
12:48:36
    at Consola.fatal (node_modules/@nuxt/cli/node_modules/consola/dist/core.cjs:308:19)
12:48:36
    at NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:366:17)
wilhantian commented 1 year ago

me too...

maxJeongCC commented 1 year ago

me too..too!

pi0 commented 1 year ago

Hi. This is an incompatibility with Node.js 14 (which is EOL since April). Please consider upgrading your Runtime Node.js to 16+. (This comes from string-width@6)

As a workaround if you cannot upgrade Node version, you can set CI=1 environment variable.

pi0 commented 1 year ago

3.2.2 has a workaround for Node 14 backward compatibility (https://github.com/unjs/consola/releases/tag/v3.2.2)

dockleryxk commented 1 year ago

@pi0 thank you for adding this workaround – I'm sure it's annoying supporting an EOL version but it's very much appreciated!