Search

경로 문제 발생 시 console error 해결하기

에러 문구

Failed to load resource: the server responded with a status of 404 ()

문제 원인

index.html 파일을 루트에서 src 폴더로 옮겼는데, index.html 파일안에 있는 파일들의 경로 수정을 안해줬던 것이 원인이었다. 경로를 수정해 주면 위의 에러는 해결된다.
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/random.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Randon Picker</title> </head> <body> <div id="root"></div> <script type="module" src="/src/main.tsx"></script> </body> </html>
HTML
복사