Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Issues with the gatsby new command #2

Closed
f0rr0 opened this issue Jul 3, 2016 · 15 comments
Closed

Issues with the gatsby new command #2

f0rr0 opened this issue Jul 3, 2016 · 15 comments

Comments

@f0rr0
Copy link

f0rr0 commented Jul 3, 2016

I am trying to use your blog as a starter template for mine using gatsby new but I guess you have modified the file structure.

@kylegach
Copy link
Owner

kylegach commented Jul 6, 2016

Sorry for the trouble you’re having, Siddharth.

I removed the required config.toml file from the repo, because it contains my Google Analytics tracking number. I’m still working out the best way to add the file back that doesn’t expose secrets like that. I would imagine this missing file is preventing gatsby new from working correctly.

In the meantime, clone the project and add a file called config.toml to the root directory, with these contents:

siteTitle = "Site Title"
blogTitle = "Blog Title"
url = "http://example.com"
linkPrefix = "/example"
email = "name@example.com"
twitter = "@handle"
github = "username"

[js]
head = """
"""
analytics = """
"""
font = """
"""

favicons = '''
'''

[header]
text = '''
<p>Header text</p>
'''

[work]
title = "Work Title"
blurb = "Work blurb"
dir = "work"

[writing]
title = "Writing Title"
blurb = "Writing blurb"
dir = "writing"

[about]
title = "About Title"
text = '''
<p>About text</p>
'''

You should then be able to run gatsby develop and have things work as expected.

@f0rr0
Copy link
Author

f0rr0 commented Jul 6, 2016

@kylegach Appreciate this a lot! Thanks

@f0rr0 f0rr0 closed this as completed Jul 6, 2016
@samuelcouch
Copy link

Adding in the config.toml allows the project to build with no errors, however I do get warnings,

WARNING in Unexpected token import
 @ ./pages ^\.\/.*$

and when I go to localhost:8000 it loads and no errors are in the console, but the page is blank.

@kylegach
Copy link
Owner

Sorry about that, Sam. Just tried myself and I’m seeing the same thing. I’m looking into it, but haven’t had any luck yet.

@KyleAMathews, have you seen anything like this before? Or could you point me in a likely direction? Thanks!

@kylegach kylegach reopened this Jul 13, 2016
@KyleAMathews
Copy link

That's kind of odd... unexpected token import suggests some sort of Babel parsing error not a problem with the config.toml. I'm going to work on a new release of Gatsby starting today/tomorrow and I'll pull this repo as part of that and see what I find.

@kylegach
Copy link
Owner

@KyleAMathews — Sorry for the confusion. I mentioned you in here because of Sam’s comment, which I don’t think has anything to do with the (no longer missing 🎉) config.toml file. I’m going to rename the issue to make that more clear.

Thanks for looking into it!

@kylegach kylegach changed the title Include gatsby compatible repo? Issues with the gatsby new command Jul 13, 2016
@KyleAMathews
Copy link

👍

@samuelcouch
Copy link

samuelcouch commented Jul 13, 2016

For reference, the error I see is:

~/projects/gatsby_kylegach_com(branch:master*) » ./node_modules/.bin/gatsby build                                                                                                                                                                   
Generating CSS
Generating Static HTML
Failed at generating HTML

~/projects/gatsby_kylegach_com/node_modules/gatsby/dist/bin/cli.js:52
      throw err;
      ^
Error: Error: Cannot find module './404.md'.
    at render-page.js:61219:42
    at webpackContextResolve (render-page.js:61219:90)
    at webpackContext (render-page.js:61216:30)
    at render-page.js:24864:20
    at Array.forEach (native)
    at module.exports (render-page.js:24859:10)
    at render-page.js:89:40
    at module.exports (render-page.js:61180:11)
    at Object.<anonymous> (render-page.js:88:2)
    at __webpack_require__ (render-page.js:30:30)

Which would correlate with the output from ./node_modules/.bin/gatsby develop

...
WARNING in Unexpected token import
 @ ./pages ^\.\/.*$

As well as the console of the page at localhost:8000
screen shot 2016-07-13 at 5 12 57 pm

@KyleAMathews
Copy link

Hey Sam if you want to push your code somewhere I'll take a look at it.
On Wed, Jul 13, 2016 at 2:14 PM Sam Couch notifications@github.com wrote:

For reference, the error I see is:

~/projects/gatsby_kylegach_com(branch:master*) » ./node_modules/.bin/gatsby build
Generating CSS
Generating Static HTML
Failed at generating HTML

~/projects/gatsby_kylegach_com/node_modules/gatsby/dist/bin/cli.js:52
throw err;
^
Error: Error: Cannot find module './404.md'.
at render-page.js:61219:42
at webpackContextResolve (render-page.js:61219:90)
at webpackContext (render-page.js:61216:30)
at render-page.js:24864:20
at Array.forEach (native)
at module.exports (render-page.js:24859:10)
at render-page.js:89:40
at module.exports (render-page.js:61180:11)
at Object. (render-page.js:88:2)
at webpack_require (render-page.js:30:30)

Which would correlate with

WARNING in Unexpected token import
@ ./pages ^./.*$

As well as the console of the page at localhost:8000
[image: screen shot 2016-07-13 at 5 12 57 pm]
https://cloud.githubusercontent.com/assets/1214373/16820045/246ff17c-491d-11e6-91ac-1aef7f029611.png


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAEVh685anILlagwyfYec_Y1ZUKC1Gcxks5qVVUzgaJpZM4JD0k3
.

@samuelcouch
Copy link

@KyleAMathews I pushed to a temp repo https://github.com/samuelcouch/kylegach_com_clone_temp as far as I can tell, gatsby new got everything that you would expect.

@KyleAMathews
Copy link

Ok so had a chance to look at this and it turns out it's just missing a .babelrc file... which is annoying as I thought we'd set Gatsby up so the .babelrc was optional...

Apparently not.

Sometimes Webpack/Babel can be a bit frustrating :-)

@kylegach
Copy link
Owner

Thanks, @KyleAMathews! I clearly thought it was optional as well. :)

I just did a fresh gatsby new, gatsby develop, gatsby build, & gatsby serve-build. Everything seems to be working now.

@KyleAMathews
Copy link

Maybe it was and now it's not :-\ What's weird is there's tests for this. Need to investigate.

@kylegach
Copy link
Owner

I remembered seeing something that could be related, and sure enough: gatsbyjs/gatsby#279

@KyleAMathews
Copy link

Yeah, that improved things a lot and one of the improvements was a user .babelrc isn't necessary. Need to check why that's not working now (at least for your site).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants