-
MSWjs : Failed to register a Service Worker for scope () with script () Service Worker script does not exist at the given path.frontend/오답노트 2022. 10. 12. 10:13
문제 : [MSW] Failed to register a Service Worker for scope ('http://localhost:3000/') with script ('http://localhost:3000/mockServiceWorker.js'): Service Worker script does not exist at the given path.
Did you forget to run "npx msw init <PUBLIC_DIR>"?[MSW] Failed to register a Service Worker for scope ('http://localhost:3000/') with script ('http://localhost:3000/mockServiceWorker.js'): Service Worker script does not exist at the given path. Did you forget to run "npx msw init <PUBLIC_DIR>"?
해당 문제는 public 패스 내에 mockServiceWorker.js가 없어서 발생하는 에러 이다.
해결방법:
//public -> <Public Dir> npx msw init /public
위의 코드를 실행하면 public에 mockServiceWorker.js가 생성되고 실행하면 정상동작 하는것을 볼 수 있다.
반응형'frontend > 오답노트' 카테고리의 다른 글