You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native Android Studio无法连接开发服务器,重装node_modules遇XML解析错误

Fixing "Forward-slash in opening tag not followed by >" Error After Reinstalling node_modules in React Native

Hey there, I’ve dealt with this exact error a few times when working on React Native Android projects, so let me break down what’s going on and how to fix it quickly.

What’s Causing This Error?

The error message points to a syntax mistake in your AndroidManifest.xml file. The sax parser (used by React Native’s CLI to read the Android manifest) is throwing a fit because it found a forward slash in an opening tag that isn’t properly closed with a >. This usually happens when you have a self-closing tag written incorrectly—like <uses-permission/ instead of <uses-permission/>, or a random typo messing up the tag structure.

Step-by-Step Fix

  1. Locate your AndroidManifest.xml
    Navigate to this path in your project: android/app/src/main/AndroidManifest.xml

  2. Fix the XML syntax error
    Jump to line 9 (as called out in the error log, column 42) and inspect the tag at that position:

    • Make sure all self-closing tags follow the format <tagName/> (no missing closing >)
    • Double-check for typos, extra characters, or unclosed tags nearby
    • If you’re stuck, copy the entire manifest content into an XML validator tool (search for one online) to pinpoint the exact issue automatically
  3. Clear cache and restart the dev server
    After fixing the manifest, run these commands to wipe any cached data that might still be causing issues:

    npx react-native clean
    npx react-native start --reset-cache
    
  4. Re-run your Android project
    Finally, launch the app again with:

    npx react-native run-android
    

Why Did Reinstalling node_modules Trigger This?

Reinstalling dependencies didn’t actually create the XML error—it just forced the React Native CLI to re-parse your manifest file (since the CLI tools are part of node_modules). The syntax mistake was already in your manifest, but it might have been overlooked until the fresh install triggered a full validation check.

内容的提问来源于stack exchange,提问作者Awais Butt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:07:44