create-react-app: The script has an unsupported MIME type ('text/html')
Hi 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"
]
}
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (7 by maintainers)
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.
i saw this message too. (chrome) but the message wasn’t reproduced during testing on safari and private mode chrome. so it seems chrome’s extension script error i installed.
Interesting. Maybe some transitive dependency is doing something funny. It’s not an error so you shouldn’t worry about it. I’ll try to find what causes it when I’m back from vacation but feel free to jump in and investigate.