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

Bug: not able to serve built site in macos #13910

Closed
snowman opened this issue May 7, 2019 · 9 comments
Closed

Bug: not able to serve built site in macos #13910

snowman opened this issue May 7, 2019 · 9 comments
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@snowman
Copy link

snowman commented May 7, 2019

Description

Error when running the command gatsby serve.

Screen Shot 2019-05-08 at 12 10 47 AM

Steps to reproduce

  cd /tmp
  gatsby new global-styles https://github.com/gatsbyjs/gatsby-starter-hello-world
  cd global-styles
  gatsby build
  gatsby serve

Environment

System:
  OS: macOS 10.14.4
  CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
  Shell: 5.3 - /bin/zsh
Binaries:
  Node: 11.13.0 - ~/.nvm/versions/node/v11.13.0/bin/node
  Yarn: 1.15.2 - /usr/local/bin/yarn
  npm: 6.7.0 - ~/.nvm/versions/node/v11.13.0/bin/npm
Languages:
  Python: 3.7.3 - /Users/peng/.virtualenvs/python-dev/bin/python
Browsers:
  Chrome: 74.0.3729.131
  Safari: 12.1
npmPackages:
  gatsby: ^2.4.2 => 2.4.2 
@cluzier
Copy link

cluzier commented May 8, 2019

You're sure you're in the correct directory? I know in the reproduction steps you do cd tmp but is tmp really the right place? Just taking a shot in the dark.

@snowman
Copy link
Author

snowman commented May 8, 2019

sorry about missing one step.. you can see the current directory in the screenshot is global-styles.

@eclectic-coding
Copy link
Contributor

I can confirm on my MacOS with the Hello-world start, the same result as you have described. However, the Default starter works fine.

@thomascorthouts
Copy link
Contributor

I was able to reproduce as well, a quick check learned me that adding the default gatsby-*.js files made this one "serve-able" from localhost.

It seems like an empty gatsby-config.js is sufficient to make it work. No immediate idea on the origin of the issue, but just putting it here.

@eclectic-coding
Copy link
Contributor

eclectic-coding commented May 8, 2019

@thomascorthouts good point. the hello-world is a fairly blank starter and it makes since it would not serve in is fresh install state.

I wonder if it would better to include a gatsby-config.js file with the basic sitemetadata and no plugins for this starter?

@eclectic-coding eclectic-coding added the type: question or discussion Issue discussing or asking a question about Gatsby label May 8, 2019
@thomascorthouts
Copy link
Contributor

@polishedwp indeed, it makes sense. The place it's used in the tutorial on the website, it's only ever been run in develop.

It might be a good addition to add a note that the serve part doesn't work in the starter docs or as you proposed to have a gatsby-config.js with basic data.

@thomascorthouts
Copy link
Contributor

In version 2.3.36 of Gatsby, it still worked without a gatsby-config.js so it seems like a breaking change that could/should at least be resolved by adding a note about it somewhere.
I think it might be related to the #12128 pathPrefix PR somehow, in that it expects to at least have a config file.

@thomascorthouts
Copy link
Contributor

In line 72 of serve.js it is introduced to const { pathPrefix: configPathPrefix } = config where if config would be null or undefined it would result in a TypeError: Cannot destructure property 'pathPrefix' of 'undefined' or 'null'. error.

@thomascorthouts
Copy link
Contributor

This issue should have been fixed with gatsby: 2.4.3 and in the newest versions of the hello-world starter, there will also be an empty gatsby-config.js included. @Unmem if you would run into this issue again, please feel free to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants