Gatsby: surge does not work - project not found

Created on 4 Jun 2019  Â·  11Comments  Â·  Source: gatsbyjs/gatsby

Description

I am following your tutorial. Local deployment works but when trying to deploy to surge it gets stuck on the below terminal screen.

The URL below will show "PROJECT NOT FOUND"

 bernardo (master *) hello-world $ surge public/
  Running as [email protected] (Student)

    project: public/
     domain: pale-religion.surge.sh

Steps to reproduce

Pretty much following the tutorial above.
gatsby build
then
surge public/

Expected result

Show site on the web

Actual result

Project not found screen is shown on surge

Environment

System:
  OS: macOS 10.14.5
  CPU: (4) x64 Intel(R) Core(TM) i5-4570S CPU @ 2.90GHz
  Shell: 3.2.57 - /bin/bash
Binaries:
  Node: 11.7.0 - /usr/local/bin/node
  npm: 6.9.0 - /usr/local/bin/npm
Languages:
  Python: 2.7.10 - /usr/bin/python
Browsers:
  Chrome: 74.0.3729.169
  Firefox: 65.0.1
  Safari: 12.1.1
npmPackages:
  gatsby: ^2.8.2 => 2.8.2
npmGlobalPackages:
  gatsby-cli: 2.6.4

Most helpful comment

oh dude, you must hit enter when stop here :
project: public/
domain: pale-religion.surge.sh
[ ENTER ]

-- Case Close --

All 11 comments

Hey @BernardA would you be able to supply a reproduction so that we can immediately test things out?

Thank you!

Hi, this is the link to the repository: https://github.com/BernardA/gatsby-hello-world
Thanks

Hey @BernardA! I've found a solution that worked on my end 😄

If you run yarn build and then cd into your new public/ directory, you can run surge inside of public and everything will work as expected.

Here's my deploy, using this method: http://raspy-tooth.surge.sh/

Thanks, but that did not work.

I do not use yarn, but rather running gatsby build.

See attached screenshot with my last attempt.
If I do surge from /public its not even providing a URI

![Screenshot 2019-06-13 at 10 05 07 PM](https://user-images.githubusercontent.com/9449665

Seems there is an issue with the attachment, so here it comes:

  bernardo (master) tutorial-part-two $ gatsby build
 success open and validate gatsby-configs - 0.013 s
 success load plugins - 0.113 s
 success onPreInit - 0.006 s
 success delete html and css files from previous builds - 0.012 s
 success initialize cache - 0.008 s
 success copy gatsby files - 0.158 s
 success onPreBootstrap - 0.088 s
 success source and transform nodes - 0.012 s
 success building schema - 0.231 s
 success createPages - 0.002 s
 success createPagesStatefully - 0.069 s
 success onPreExtractQueries - 0.002 s
 success update schema - 0.018 s
 success extract queries from components - 0.014 s
 success run static queries - 0.003 s
 success run page queries - 0.014 s — 2/2 200.72 queries/second
 success write out page data - 0.006 s
 success write out redirect data - 0.006 s
 success onPostBootstrap - 0.002 s
 info bootstrap finished - 16.551 s
 success Building production JavaScript and CSS bundles - 6.738 s
â ‹ Building static HTML for pages
{ user: 'about-css-modules-module--user--2CXbd',
avatar: 'about-css-modules-module--avatar--2lRF7',
description: 'about-css-modules-module--description--ev5yS',
 username: 'about-css-modules-module--username--2EBkm',
 success Building static HTML for pages - 0.916 s — 2/2 3.60 pages/second
 info Done building in 24.222 sec

bernardo (master) tutorial-part-two $ cd public
bernardo (master) public $ surge 

 Running as [email protected] (Student)

    project: /Users/bernardo/Sites/tutorial-part-two/public/

oh dude, you must hit enter when stop here :
project: public/
domain: pale-religion.surge.sh
[ ENTER ]

-- Case Close --

No kidding! Is one supposed to know that how? Not sure I remember ever having to hit enter AFTER entering a command on CLI.

I was in the same boat until I saw this fix! The Gatsby document should be modified to reflect this!!!

It's very strange that you need to press 'Enter' and it's stranger still that it doesn't prompt you to do so.

I'd lost count of how many instances I'd "spun up".

Hey @BernardA! I've found a solution that worked on my end 😄

If you run yarn build and then cd into your new public/ directory, you can run surge inside of public and everything will work as expected.

Here's my deploy, using this method: http://raspy-tooth.surge.sh/

work for me. thank you very much

this worked for me on Windows 10 ,git, npm (not Yarn)

  1. via CLI, INSIDE project dir created with gatsby, type npx gatsby build (mine was hello)
    2, after done building, while inside project folder (i.e. hello), type npx surge public/
  2. after domain .surge.sh, press
    4.says published to .surge.sh
  3. in browser, type in .surge.sh
  4. should see your website
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  3Comments

hobochild picture hobochild  Â·  3Comments

magicly picture magicly  Â·  3Comments

rossPatton picture rossPatton  Â·  3Comments

mikestopcontinues picture mikestopcontinues  Â·  3Comments