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

gatsby develop -> Cannot read property 'indexOf' of undefined #210

Closed
tleunen opened this issue Mar 25, 2016 · 4 comments
Closed

gatsby develop -> Cannot read property 'indexOf' of undefined #210

tleunen opened this issue Mar 25, 2016 · 4 comments

Comments

@tleunen
Copy link
Contributor

tleunen commented Mar 25, 2016

I reinstalled gatsby, I guess one of the dependencies was updated and now I get this error when I run gatsby develop

Debug: internal, implementation, error 
    TypeError: Uncaught error: Cannot read property 'indexOf' of undefined
  at getFilenameFromUrl (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/webpack-dev-middleware/middleware.js:129:9)
  at webpackDevMiddleware (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/webpack-dev-middleware/middleware.js:174:18)
  at /Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi-webpack-plugin/lib/index.js:58:5
  at /Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/handler.js:311:22
  at iterate (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/node_modules/items/lib/index.js:35:13)
  at done (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/node_modules/items/lib/index.js:27:25)
  at Function.wrapped [as _next] (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/node_modules/hoek/lib/index.js:858:20)
  at Function.internals.continue (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/reply.js:105:10)
  at /Users/tleunen/dev/tp/node_modules/gatsby/dist/utils/develop.js:146:25
  at /Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/handler.js:311:22
  at iterate (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/node_modules/items/lib/index.js:35:13)
  at Object.exports.serial (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/node_modules/items/lib/index.js:38:9)
  at /Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/handler.js:306:15
  at [object Object].internals.Protect.run (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/protect.js:56:5)
  at Object.exports.invoke (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/handler.js:304:22)
  at [object Object].internals.Request._execute (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/request.js:311:13)
  at Domain.<anonymous> (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/connection.js:246:25)
  at Domain.run (domain.js:228:14)
  at Server.<anonymous> (/Users/tleunen/dev/tp/node_modules/gatsby/node_modules/hapi/lib/connection.js:244:37)
  at emitTwo (events.js:100:13)
  at Server.emit (events.js:185:7)
  at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:537:12)
  at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)

After investigation, inside the develop script, this is true negotiator.mediaType() === 'text/html'. Therefore, the system tries to load a page at /html/ but nothing exists there...

@tleunen
Copy link
Contributor Author

tleunen commented Mar 25, 2016

So after investigation, it's indeed a dependency. And it's webpack-dev-middleware. The version 1.5.1 works, but v1.6.0 doesn't work with gatsby.

@KyleAMathews
Copy link
Contributor

webpack/webpack-dev-middleware@b05cd04 is what broke things.

There's an open PR to fix it webpack/webpack-dev-middleware#80

@KyleAMathews
Copy link
Contributor

Note, this isn't a direct dependency of Gatsby. We depend on https://github.com/SimonDegraeve/hapi-webpack-plugin which depends on webpack-dev-middleware.

@KyleAMathews
Copy link
Contributor

1.6.1 of webpack-dev-middleware was released today which rolled-back the regression. webpack/webpack-dev-middleware@8044d04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants