Issues with the `gatsby new` command
f0rr0 opened this issue · comments
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.
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.
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.
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!
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.
@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!
👍
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 ^\.\/.*$
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
.
@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.
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 :-)
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.
Maybe it was and now it's not :-\ What's weird is there's tests for this. Need to investigate.
I remembered seeing something that could be related, and sure enough: gatsbyjs/gatsby#279
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).