In Node.js v21+, TypeError [ERR_INVALID_ARG_VALUE] from util.styleText()
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
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
- Steps to Reproduce
- Install Node.js v21.0.0 or higher
- Create a new React Native project or use existing one
- Run npx react-native start
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at @react-native/community-cli-plugin's start command and the attachKeyHandlers.js entry point named in the stack trace, then reproduce with Node.js 21.7.3 using npx react-native start. Done means the development server starts without the util.styleText() invalid-argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, react-native
- Domain
- cli, mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100