服务器问题

来源:5-2 连接真实服务端 - 专属开发者⼯具介绍与安装

晴晴白羊

2021-02-26

A bad HTTP response code (404) was received when fetching the script.
index.js?9788:136 [MSW] Failed to register a Service Worker for scope (‘http://127.0.0.1:1111/’) with script (‘http://127.0.0.1:1111/mockServiceWorker.js’): Service Worker script does not exist at the given path.

Did you forget to run “npx msw init <PUBLIC_DIR>”?

Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init
运行了npx msw init public --save 不管用

写回答

1回答

Nolan

2021-02-27

检查一下public文件夹下面有mockServiceWorker.js文件吗?没有的话再运行 npx msw init public,然后重启本地服务器。还不行的话代码发我吧

0
0

React17+Hook+TS4 优质实践,仿 Jira 企业级项目

解锁 React17 高阶用法,轻松应对大型复杂长周期项目

2691 学习 · 1236 问题

查看课程