Home  >  Q&A  >  body text

Server error: File /src/main.jsx not found (resolving id: /src/main.jsx)

I typed "npm run dev" to run the application but I got this error: "Unable to load url /src/main.jsx (resolved id: /src/main.jsx). Does the file exist?" and the page is white. Code written in main.jsx:

import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import './index.css'

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <App/>
  </React.StrictMode>,
)

I need quick help, thank you

I tried restarting VS Code and the server but it didn't work I tried "npm i" but it didn't work either

P粉421119778P粉421119778304 days ago489

reply all(1)I'll reply

  • P粉938936304

    P粉9389363042023-11-23 13:47:01

    I encountered the exact same error because my project path was too long.

    The path of my project is C:\Users\User\Documents\1 My Projects\C#\Complex\MyAwesomeProject API_REACT_DOCKER\ProfileWebApp

    I moved the project to C:\Users\User\Documents\MyAwesomeProject

    It solves this problem.

    reply
    0
  • Cancelreply