create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

The script has an unsupported MIME type ('text/html')

Open bodadotsh opened this issue 10 years ago • 18 comments

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

bodadotsh avatar Sep 16 '16 11:09 bodadotsh

Can you please share your browser version and OS?

gaearon avatar Sep 16 '16 20:09 gaearon

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

bodadotsh avatar Sep 17 '16 19:09 bodadotsh

Could you please show a screenshot? Thanks.

gaearon avatar Sep 17 '16 19:09 gaearon

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.

bodadotsh avatar Sep 17 '16 21:09 bodadotsh

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.

gaearon avatar Sep 17 '16 21:09 gaearon

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

bodadotsh avatar Sep 20 '16 21:09 bodadotsh

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

gaearon avatar Sep 21 '16 17:09 gaearon

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

gaearon avatar Sep 23 '16 11:09 gaearon

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.

dongjinahn avatar Oct 21 '16 02:10 dongjinahn

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.

nikhildev avatar Nov 12 '16 07:11 nikhildev

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.

rob-yoti avatar Dec 07 '16 17:12 rob-yoti

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

soulcm avatar Dec 11 '16 07:12 soulcm

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 avatar Dec 11 '16 08:12 n3tr

@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

soulcm avatar Dec 11 '16 10:12 soulcm

Thanks, n3tr's trick definitely solves the problem 👍

skhamoud avatar Jan 12 '17 23:01 skhamoud

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.

vers10ne avatar Feb 15 '17 12:02 vers10ne

me too!

image

xyzdata avatar Jul 12 '17 12:07 xyzdata

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.

gaearon avatar Jul 12 '17 12:07 gaearon