-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Failed to load url /sw.js. Does the file exist? #1427
Comments
was there a resolution to this? I was getting the same “Does the file exist?” error but for |
service workers should be placed in |
Same here, I don't use nor import any sw.js file, but vite out of the blue display that error |
You probably loaded another app with service worker on the same localhost port before, and your browser is thinking it's the same app and attempting to request the service worker. You need to delete your service worker for that localhost port (from Chrome devtools' application tab). Or, use a different port so Chrome doesn't get confused. |
Thank you @yyx990803, that was the error. |
starting with vite 2.3.0 orphaned service workers produce a much noisier error message
Maybe vite should not try to fallback to fs root for paths without a directory structure? ie |
There's another non-service-worker-related repro in sveltejs/kit#1420 using SvelteKit. Vite balks when the browser runs |
npm run dev 后提示:
5:43:23 PM [vite] Internal server error:
Error: Failed to load url /sw.js. Does the file exist?
at transformRequest (/home/l/workspace/my-vue-app/node_modules/vite/dist/node/chunks/dep-85227760.js:66195:15)
at async /home/l/workspace/my-vue-app/node_modules/vite/dist/node/chunks/dep-85227760.js:66292:32
[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at vuejs/rfcs#227.
[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.
package.json内容如下:
{
"name": "my-vue-app",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"vue": "^3.0.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.0.4",
"@vue/compiler-sfc": "^3.0.5",
"vite": "^2.0.0-beta.12"
}
}
node 版本: v14.15.1
~
The text was updated successfully, but these errors were encountered: