Skip to content

In Node.js v21+, TypeError [ERR_INVALID_ARG_VALUE] from util.styleText() #54563

@jiangtao

Description

@jiangtao

Description

The React Native development server fails to start on Node.js v21+ with the following error:

`
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'format' must be one of: 'reset', 'bold', 'dim', 'italic', 'underline', 'blink', 'inverse', 'hidden', 'strikethrough', 'doubleunderline', 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'bgBlack', 'bgRed', 'bgGreen', 'bgYellow', 'bgBlue', 'bgMagenta', 'bgCyan', 'bgWhite', 'framed', 'overlined', 'gray', 'redBright', 'greenBright', 'yellowBright', 'blueBright', 'magentaBright', 'cyanBright', 'whiteBright', 'bgGray', 'bgRedBright', 'bgGreenBright', 'bgYellowBright', 'bgBlueBright', 'bgMagentaBright', 'bgCyanBright', 'bgWhiteBright'. Received [ 'bold', 'inverse' ]

at styleText (node:util:210:5)
at attachKeyHandlers (/path/to/node_modules/@react-native/community-cli-plugin/dist/commands/start/attachKeyHandlers.js:91:25)

`

Steps to reproduce

  1. Steps to Reproduce
  2. Install Node.js v21.0.0 or higher
  3. Create a new React Native project or use existing one
  4. Run npx react-native start
  5. Observe the error

React Native Version

0.82.1

Affected Platforms

Other (please specify)

Output of npx @react-native-community/cli info

React Native version: 0.82.1
@react-native/community-cli-plugin version: 0.82.1
Node.js version: 21.7.3
Operating System: macOS 23.3.0

Stacktrace or Logs

`
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'format' must be one of: 'reset', 'bold', 'dim', 'italic', 'underline', 'blink', 'inverse', 'hidden', 'strikethrough', 'doubleunderline', 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'bgBlack', 'bgRed', 'bgGreen', 'bgYellow', 'bgBlue', 'bgMagenta', 'bgCyan', 'bgWhite', 'framed', 'overlined', 'gray', 'redBright', 'greenBright', 'yellowBright', 'blueBright', 'magentaBright', 'cyanBright', 'whiteBright', 'bgGray', 'bgRedBright', 'bgGreenBright', 'bgYellowBright', 'bgBlueBright', 'bgMagentaBright', 'bgCyanBright', 'bgWhiteBright'. Received [ 'bold', 'inverse' ]

    at styleText (node:util:210:5)
    at attachKeyHandlers (/path/to/node_modules/@react-native/community-cli-plugin/dist/commands/start/attachKeyHandlers.js:91:25)

MANDATORY Reproducer

https://github.com/jiangtao/react-native-in-node21

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions