gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.2k stars 10.33k forks source link

Getting socket.io.js & commons.js error while loading github pages built using gatsby #3229

Closed jaanhio closed 6 years ago

jaanhio commented 6 years ago

Description

Getting socket.io.js & commons.js error while loading github pages built using gatsby (https://jaanhio.github.io/).

I am not sure why these 2 errors are appearing. Could it be some dependencies issue?

Environment

Gatsby version: 1.9.119 Node.js version: 8.4.0 Operating System: macOS Sierra

File contents (if changed):

gatsby-config.js:

module.exports = {
  siteMetadata: {
    title: `jaanhio`
  },
  plugins: [
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-styled-components`,
  ],
}

package.json:

{
  "name": "gatsby-starter-default",
  "description": "Gatsby default starter",
  "version": "1.0.0",
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
  "dependencies": {
    "gatsby": "^1.9.119",
    "gatsby-link": "^1.6.28",
    "gatsby-plugin-favicon": "^2.0.0",
    "gatsby-plugin-react-helmet": "^1.0.8",
    "gatsby-plugin-styled-components": "^2.0.2",
    "material-ui": "^1.0.0-beta.21",
    "react-animations": "^1.0.0",
    "react-anime": "^2.0.1",
    "react-headroom": "^2.2.2",
    "react-reveal": "^0.7.3",
    "react-scroll": "^1.6.4",
    "react-social-icons": "^2.7.0",
    "react-typing-animation": "^1.1.5",
    "styled-components": "^2.2.4"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "main": "n/a",
  "scripts": {
    "deploy": "gatsby build --prefix-paths && gh-pages -d public",
    "build": "gatsby build",
    "develop": "gatsby develop",
    "format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"src/**/*.js\"",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "eslint": "^4.11.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.2",
    "eslint-plugin-react": "^7.5.1",
    "gh-pages": "^1.1.0",
    "prettier": "^1.8.2"
  }
}

Actual result

GET https://jaanhio.github.io/socket.io/socket.io.js net::ERR_ABORTED
jaanhio.github.io/:2 
GET https://jaanhio.github.io/commons.js 404 ()
markmichon commented 6 years ago

It looks like your index file is somehow the index created by gatsby develop and not the one from gatsby build. Try clearing out your pubic folder, then run gatsby build. You can test by running gatsby serve before pushing overything up to github pages.

jaanhio commented 6 years ago

Thanks @markmichon! it worked!

however, i am not sure why react-track is no longer working as intended, will have to check on it.

Thanks again!

Sergey80 commented 5 years ago

same issue. works with develop. does not work when do build. tried to remove the public folder and create again. same... got: socket.io/socket.io.js net::ERR_ABORTED 404

bpsmpls commented 5 years ago

Same issue as well. Works with gatsby develop. gatsby build completes successfully, but fails to load anything on production the first time. 404 errors on missing socket.io and commons.js. Second consecutive page load works, however.

CannibalKush commented 5 years ago

I also have this problem. I'm not sure how I got here either, as I'm using project files that were definitely working before. Maybe a change in my local environment?

Happens on gatsby develop as well as serve. Ubuntu 18.04

MTyson commented 4 years ago

In my experience, to get the build to run reliably you must: delete /public, run gatsby clean, wipe remote host, run gastby build, push all files up.

This also addresses the page load fail with 404s on socket/common.js

MTyson commented 4 years ago

Cancel that, still seeing 404s for socket.js and common.js

MTyson commented 4 years ago

Burning a lot of time debugging gatsby issues.

jimfilippou commented 4 years ago

I am still seeing this, why is this happening? also why it's closed?

jlee0425 commented 4 years ago

It looks like your index file is somehow the index created by gatsby develop and not the one from gatsby build. Try clearing out your pubic folder, then run gatsby build. You can test by running gatsby serve before pushing overything up to github pages.

In addition to this, try deleting /node_modules/.cache/gh_pages. It worked for me.

doubledherin commented 4 years ago

It looks like your index file is somehow the index created by gatsby develop and not the one from gatsby build. Try clearing out your pubic folder, then run gatsby build. You can test by running gatsby serve before pushing overything up to github pages.

In addition to this, try deleting /node_modules/.cache/gh_pages. It worked for me.

There's no .cache in my node_modules