Терминал зависает когда я пытаюсь запустить React Native приложение на эмулятор Android
При вводе npm run android терминал тупо зависает, не пишет ничего (нет ошибок и предупреждений).
Если я ввожу npx react-native doctor, выдает
✓ Node.js - Required to execute JavaScript code
✓ npm - Required to install NPM dependencies
● Metro - Metro Bundler is not running
Android
✓ Adb - Required to verify if the android device is attached correctly
✓ JDK - Required to compile Java code
✓ Android Studio - Required for building and installing your app on Android
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
✓ Gradlew - Build tool required for Android builds
✓ Android SDK - Required for building and installing your app on Android
Errors: 0
Warnings: 1
Usage
› Press f to try to fix issues.
› Press e to try to fix errors.
› Press w to try to fix warnings.
› Press Enter to exit.
Если я ввожу npm run start, metro запускается, но если я нажимаю A чтобы запустить приложение на эмуляторе, пишется следующее
info Opening app on Android...
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["X-React-Native-Project-Root"]
at ServerResponse.setHeader (node:_http_outgoing:702:3)
at statusPageMiddleware (/home/youngneil/Документы/zhabblerrn/node_modules/@react-native-community/cli-server-api/build/statusPageMiddleware.js:19:7)
at call (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:239:7)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:183:5)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at nocache (/home/youngneil/Документы/zhabblerrn/node_modules/nocache/index.js:11:5)
at call (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:239:7)
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["X-React-Native-Project-Root"]
at ServerResponse.setHeader (node:_http_outgoing:702:3)
at statusPageMiddleware (/home/youngneil/Документы/zhabblerrn/node_modules/@react-native-community/cli-server-api/build/statusPageMiddleware.js:19:7)
at call (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:239:7)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:183:5)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at next (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:161:14)
at nocache (/home/youngneil/Документы/zhabblerrn/node_modules/nocache/index.js:11:5)
at call (/home/youngneil/Документы/zhabblerrn/node_modules/connect/index.js:239:7)
Error: Command failed with exit code 1: sh /home/youngneil/Документы/zhabblerrn/node_modules/.generated/launchPackager.command
error Another process is running on port 8081. Please terminate this process and try again, or use another port with "--port".
info Welcome to React Native v0.76
Process terminated. Press <enter> to close the window
at makeError (/home/youngneil/Документы/zhabblerrn/node_modules/execa/lib/error.js:60:11)
at module.exports.sync (/home/youngneil/Документы/zhabblerrn/node_modules/execa/index.js:194:17)
at startServerInNewWindow (/home/youngneil/Документы/zhabblerrn/node_modules/@react-native-community/cli-tools/build/startServerInNewWindow.js:116:31)
at Object.runAndroid [as func] (/home/youngneil/Документы/zhabblerrn/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:97:46)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Command.handleAction (/home/youngneil/Документы/zhabblerrn/node_modules/@react-native-community/cli/build/index.js:118:9)
info Run CLI with --verbose flag for more details.
Если я поменяю порт metro на другой, к примеру 8089 npm run start -- --port=8089, ошибки нет но терминал опять зависает.
В React Native я новичок и могу что-то не понимать, но приложение ранее писалось на системе Windows и все работало прекрасно. Сейчас у меня стоит Fedora 42, и перед тем как запустить приложение я удалил папку node_modules и написал команду npm install.
Я пробовал создавать новое приложение командой npx @react-native-community/cli@latest init ProjectName приложение создается, но при запуске его всё тот же результат, терминал зависает.
Ответы (1 шт):
Оказывается, что из-за того что папка с приложением находилась в папке 'Документы' (папка которая имеет кириллицу а не латинские буквы) терминал зависал. Проблему исправил просто, переименовал папку в Documents и теперь все работает.