Create-react-app: The script has an unsupported MIME type ('text/html')

Created on 16 Sep 2016  路  18Comments  路  Source: facebook/create-react-app

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"
    ]
  }
}

bug

Most helpful comment

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.

All 18 comments

Can you please share your browser version and OS?

browser version: Version 53.0.2785.116 (64-bit)
os: OS X El Capitan version 10.11.6

Could you please show a screenshot? Thanks.

just created a new project from scratch, still getting this error.

screenshot here:
http://i.imgur.com/EjywosK.png

did 'npm uninstall -g create-react-app' and reinstalled it globally, made a test app still same error.

Interesting. Maybe some transitive dependency is doing something funny.
It鈥檚 not an error so you shouldn鈥檛 worry about it.
I鈥檒l try to find what causes it when I鈥檓 back from vacation but feel free to jump in and investigate.

finally found the solution after days of 'googling'

run npm run prepublish inside the webpack-dev-server global library installed folder (/Users/bodaz/.npm-packages/lib/node_modules), and that seems fixed everything, the browser is back to normal and no more error messages at localhost:3000

for the record, the webpack version i had installed globally is webpack 1.13.2
and this is the link where i got my solution from: https://github.com/webpack/webpack-dev-server/issues/326

Why would a global webpack-dev-server matter?
We don鈥檛 use the global version anywhere as far as I know.

Closing as it鈥檚 not clear how to reproduce this, and original author has resolved the problem.

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.

I've been running in the same issue. The local version is [email protected]. Im running Windows 10, Chrome 56.0.2906.0 dev (64-bit).

At this point I'm clueless on what to do.

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.

yes, I got this issue too, when I build my app and run it in a server side render application in express, the chrome show those two errors

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.

@n3tr thanks, yes, you are right, I remember I test some app before and register the service work, now as your step, I unregister the service work and it goes fine

Thanks, n3tr's trick definitely solves the problem 馃憤

testing my app on firebase hosting still produces the same error..
but curious that it didn't do this for previous deploys.. (i don't think).
in local the error doesn't come up.
Could it be because of any component being used eg a menu..?
it's something that was added.

me too!

image

If you have this problem and this discussion doesn't help please file a new issue and fill the template. Provide a project reproducing this.

Further +1's are not helpful so I am locking this.

Was this page helpful?
0 / 5 - 0 ratings