unjs / consola

🐨 Elegant Console Logger for Node.js and Browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FATAL Intl.Segmenter is not a constructor with Node 14

dockleryxk opened this issue · comments

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)

me too...

me too..too!

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.

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

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