Issue
I use wsl ubuntu, if this information is important.
I tried to create a react native project using the following command
npx react-native init myApp
And it fails with the following error:
/home/toufik/node_modules/@react-native-community/cli-doctor/build/commands/doctor.js:127
description: description ?? healthcheck.description,
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/toufik/node_modules/@react-native-community/cli-doctor/build/index.js:19:38)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
I installed npm with the command sudo apt-get install npm
and I think there shouldn't be any problem with this.
my npm version is 8.5.1 and nodejs version is 12.22.9
Solution
From the 0.72 React Native setup instructions:
Node
Follow the installation instructions for your Linux distribution to install Node 16 or newer.
I recommend nvm to install node to get the latest versions, etc. https://github.com/nvm-sh/nvm
Answered By - redwards Answer Checked By - Mary Flores (WPSolving Volunteer)