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

VSCode崩溃后执行npm start时React项目运行在异常URL的问题求助

Troubleshooting React App URL & Blank Page Issue After VSCode Crash

Hey Bryan, sorry to hear you ran into this weird glitch after VSCode crashed on you. Let's walk through some practical fixes that should get your app back up and running normally:

1. Wipe Dev Server & Dependency Caches

Corrupted caches are a common culprit here—let's start fresh:

  • Stop your running npm start process with Ctrl + C in the terminal
  • Delete your node_modules folder, package-lock.json (or yarn.lock if you use Yarn) from the project root
  • Run npm install to reinstall clean dependencies
  • Fire up npm start again and check if the URL is back to http://localhost:3000

2. Check for Misconfigured Environment Variables

React uses the PUBLIC_URL variable to set your app's base path, which might have gotten messed up during the crash:

  • Look for a .env file in your project root
  • If you see a line like PUBLIC_URL="/bryansomto/appName", change it to PUBLIC_URL="/" or delete the line entirely
  • Restart your dev server after making this tweak

3. Clear Browser Cache & Local Storage

Your browser might be clinging to old routing data that's causing the blank page:

  • Open your browser's dev tools (F12 or Ctrl+Shift+I)
  • Head to the Application tab
  • Under Storage, click "Clear site data" to wipe cache, cookies, and local storage
  • Do a hard refresh (Ctrl+Shift+R) on the page afterward

4. Verify React Router Configuration (If You Use It)

If you're using React Router, double-check that the base path wasn't accidentally modified:

  • Find where you render BrowserRouter in your app
  • If it has a basename prop set to "/bryansomto/appName", remove that prop or set it to basename="/"
  • Example of the corrected code:
    <BrowserRouter basename="/">
      {/* Your routes go here */}
    </BrowserRouter>
    

5. Reset VSCode Workspace State

VSCode crashes can leave wonky hidden workspace settings behind:

  • Close VSCode completely
  • Locate the .vscode folder in your project root (it's hidden by default)
  • Rename it to .vscode-old or delete it entirely
  • Reopen VSCode and your project, then run npm start again

If none of these work, quickly check your public/index.html to make sure there are no hardcoded paths pointing to /bryansomto/appName—that's a rare but possible issue.

内容的提问来源于stack exchange,提问作者Bryan Somto

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.28 14:18:11