The script has an unsupported MIME type ('text/html')
See original GitHub issueHi I’ve written a small project with create-react-app, it runs in the browser ‘http://localhost:3000/’ with ‘npm start’ but i’m seeing these two errors in the console:
The script has an unsupported MIME type ('text/html'). :3000/service-worker.js:1
GET http://localhost:3000/service-worker.js net::ERR_INSECURE_RESPONSE :3000/service-worker.js:1
this is my package.json
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-scripts": "0.4.1"
},
"dependencies": {
"react": "^15.3.1",
"react-dom": "^15.3.1",
"react-redux": "^4.4.5",
"redux": "^3.6.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "./node_modules/react-scripts/config/eslint.js"
},
"standard": {
"globals": [
"describe",
"context",
"before",
"beforeEach",
"after",
"afterEach",
"it",
"expect"
]
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Service Worker registration error: Unsupported MIME type ...
The script has an unsupported MIME type ('text/html'). Failed to load resource: net::ERR_INSECURE_RESPONSE ( ...
Read more >Error: Service worker has an unsupported MIME type ('text ...
My understanding of the MIME type error is that indicates that the service worker did not register correctly. I just ran npx create-react-app...
Read more >The script has an unsupported MIME type ('text/html')
I get following error: The script has an unsupported MIME type ('text/html'). service worker error DOMException: Failed to register a ...
Read more >The script has an unsupported MIME type ('text/js')
I am getting error in the browser console The script has an unsupported MIME type ('text/js') and also getting Registration failed with SecurityError: ......
Read more >service-worker - Unsupported MIME type ('text/html') - iTecNote
I'm using create-react-app with an express server. create-react-app has a pre-configured ServiceWorker that caches local assets ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe I’m wrong, the error is about service worker has been register for localhost:3000.
Can you open Chrome Dev Tools -> Application -> Service Worker and see if you have a service worker has been registered? If yes click unregister and refresh the page again.
I got this issue after running
npm run build
on a new app, and moving the build folder to my express application which then served it.It appears the helmet middleware was interfering with the client side caching, so if you have this issue on a node server, it may be worth checking this.