Skip to content
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

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

Closed
boda-sh opened this issue Sep 16, 2016 · 18 comments
Closed

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

boda-sh opened this issue Sep 16, 2016 · 18 comments

Comments

@boda-sh
Copy link

boda-sh commented Sep 16, 2016

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

@gaearon
Copy link
Contributor

gaearon commented Sep 16, 2016

Can you please share your browser version and OS?

@boda-sh
Copy link
Author

boda-sh commented Sep 17, 2016

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

@gaearon
Copy link
Contributor

gaearon commented Sep 17, 2016

Could you please show a screenshot? Thanks.

@boda-sh
Copy link
Author

boda-sh commented Sep 17, 2016

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.

@gaearon
Copy link
Contributor

gaearon commented Sep 17, 2016

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.

@boda-sh
Copy link
Author

boda-sh commented Sep 20, 2016

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: webpack/webpack-dev-server#326

@gaearon
Copy link
Contributor

gaearon commented Sep 21, 2016

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

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

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

@gaearon gaearon closed this as completed Sep 23, 2016
@dongjinahn
Copy link

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.

@nikhildev
Copy link

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.

@rob-yoti
Copy link

rob-yoti commented Dec 7, 2016

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.

@soulcm
Copy link

soulcm commented Dec 11, 2016

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

@n3tr
Copy link
Contributor

n3tr commented Dec 11, 2016

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.

@soulcm
Copy link

soulcm commented Dec 11, 2016

@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

@skhamoud
Copy link

Thanks, n3tr's trick definitely solves the problem 👍

@vers10ne
Copy link

vers10ne commented Feb 15, 2017

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.

@xyzdata
Copy link

xyzdata commented Jul 12, 2017

me too!

image

@gaearon
Copy link
Contributor

gaearon commented Jul 12, 2017

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.

@facebook facebook locked and limited conversation to collaborators Jul 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants