androidreactjsreact-nativeexpo

TypeError: Invalid character in header content ["X-React-Native-Project-Root"] When opening a fresh expo app from android


I wanted to start learning react native, so I created an expo project using the command npx create-expo-app@latest. Then to start the app server I entered the command npx expo start from the project directory. I downloaded the "expo go" application to my android phone from the play store and scanned the QR code I got from the previous command and then I got this error in the terminal:

TypeError: Invalid character in header content ["X-React-Native-Project-Root"]
    at ServerResponse.setHeader (node:_http_outgoing:702:3)
    at C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\@expo\cli\src\start\server\metro\dev-server\createMetroMiddleware.ts:71:9
    at call (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:239:7)
    at next (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:183:5)
    at next (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:161:14)
    at next (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:161:14)
    at next (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:161:14)
    at compression (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\compression\index.js:215:5)
    at call (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:239:7)
    at next (C:\Users\Sync\Documents\עבודות לבית ספר\webbing\react basics\my-expo-app\node_modules\connect\index.js:183:5)

And as to my phone I got this error in the "expo go" app:

Something went wrong.
Packager is not running at http://192.168.1.210:8081

I am using:

Node js 22.12.0
expo 52.0.23

Also I should methion that the commands npm run android and npm run ios do not work either. However the web version works just fine. I tried creating the project with a different version of Node js (18.20.5) but then I got a different error.


Solution

  • Turns out that an expo project's path must only have English letters - and mine also had hebrew letters. So after moving the project to another folder in a path with only English letters the error stopped occuring.