Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

WebpackError: Cannot read property 'node' of undefined #10

Closed
antonioOrtiz opened this issue Mar 5, 2018 · 4 comments
Closed

WebpackError: Cannot read property 'node' of undefined #10

antonioOrtiz opened this issue Mar 5, 2018 · 4 comments

Comments

@antonioOrtiz
Copy link

antonioOrtiz commented Mar 5, 2018

Anyone run into this when trying to run a build?

error Building static HTML for pages failed

See our docs page on debugging HTML builds for help https://goo.gl/yL9lND

  58 |         ? this.props.data.allAuthorsJson.edges
  59 |         : [];
> 60 |     const getAuthor = () => authorsEdges[0].node;
     |                                             ^
  61 | 
  62 |     return (
  63 |       <Drawer className="author-template" isOpen={this.state.menuOpen}>


  WebpackError: Cannot read property 'node' of undefined

   - author.jsx:60 getAuthor
     src/templates/author.jsx:60:45

   - author.jsx:78 AuthorTemplate.render
     src/templates/author.jsx:78:34

   - ReactCompositeComponent.js:796 ReactCompositeComponentWrapper._renderValidatedComponentWithoutO    wnerOrContext
~/react-dom/lib/ReactCompositeComponent.js:796:1

   - ReactCompositeComponent.js:819 ReactCompositeComponentWrapper._renderValidatedComponent
~/react-dom/lib/ReactCompositeComponent.js:819:1

   - ReactCompositeComponent.js:359 ReactCompositeComponentWrapper.performInitialMount
~/react-dom/lib/ReactCompositeComponent.js:359:1

   - ReactCompositeComponent.js:255 ReactCompositeComponentWrapper.mountComponent
~/react-dom/lib/ReactCompositeComponent.js:255:1

   - ReactReconciler.js:43 Object.mountComponent
~/react-dom/lib/ReactReconciler.js:43:1

   - ReactMultiChild.js:234 ReactDOMComponent.mountChildren
~/react-dom/lib/ReactMultiChild.js:234:1

   - ReactDOMComponent.js:657 ReactDOMComponent._createContentMarkup
~/react-dom/lib/ReactDOMComponent.js:657:1

   - ReactDOMComponent.js:524 ReactDOMComponent.mountComponent
~/react-dom/lib/ReactDOMComponent.js:524:1
@haysclark
Copy link
Owner

haysclark commented Mar 7, 2018

Unfortunately, that error message is miss-leading, this is the actual error.

> 60 | const getAuthor = () => authorsEdges[0].node;

Check the blogAuthorDir value in your data/SiteConfig.js file. Within that folder, there MUST be an 'authors' folder, which MUST contains at least one author JSON file.

Author filename example for 'casper' user:
casper.json

Expected formatting for an author JSON file:

{
  "id": "casper",
  "name": "Casper User",
  "image": "https://api.adorable.io/avatars/150/test.png",
  "url": "http://gatsbyjs.org/",
  "location": "North Pole, Earth",
  "bio": "Yeah, I like animals better than people sometimes... Especially dogs. Dogs are the best. Every time you come home, they act like they haven't seen you in a year. And the good thing about dogs... is they got different dogs for different people.",
  "socialUrls": [
    "https://github.com/gatsbyjs",
    "https://twitter.com/gatsbyjs",
    "mailto:gatsbyjs@example.com"
  ]
}

haysclark added a commit that referenced this issue Mar 7, 2018
Adding build time error to warn users if ‘authors’ folder is missing and improving posts and authors content documentation.
Resolves #10
haysclark added a commit that referenced this issue Mar 7, 2018
Adding build time error to warn users if ‘authors’ folder is missing and improving posts and authors content documentation.
Resolves #10
@haysclark
Copy link
Owner

@antonioOrtiz Feel free to re-open this issue if you are still running into trouble.

@madhusudhan1234
Copy link

madhusudhan1234 commented Feb 7, 2019

Hi Everyone, I got the following error message while running the gatsby build command for the first time.
screen shot 2019-02-07 at 8 20 46 am

However, gatsby develop command works fine. Could you please help me on this 😊.

@madhusudhan1234
Copy link

Hi Everyone, I got the following error message while running the gatsby build command for the first time.
screen shot 2019-02-07 at 8 20 46 am

However, gatsby develop command works fine. Could you please help me on this 😊.

Hi @haysclark after adding nodes in pageContex property in tag.jsx issue is fixed now. Like this
pageContext: { nodes, tag, page, pages, total, limit, prev, next }

But still there is the cannot find module '!raw-loader' warning is still there.

soul-wish added a commit to soul-wish/gatsby-starter-casper that referenced this issue Feb 8, 2019
* fix: re-adding Disqus support

enable Disqus comments in posts by providing a ‘disqusShortname’ in the SiteConfig.js.

Resolved haysclark#9

* chore(release): 1.0.4

* fix: adding basic validation for authors

Adding build time error to warn users if ‘authors’ folder is missing and improving posts and authors content documentation.
Resolves haysclark#10

* fix: fixing sample-post dates and folder names

Posts now to have YEAR-MONTH-DAY formatting, allowing GraphQL to sort them correctly.  Post folder names corrected to match the date in each .md file.

* perf: removing dead GraphQL query

* chore(release): 1.0.5

* fix: improving npm ‘clean’ script to wipe .cache

Sometime Gatsby does not clear the .cache folder which can lead to confusion. Running ‘npm clean’, will now delete both public and .cache to aid in resolving this issue.

* fix: fixing MainNav rendering

Adding missing ‘overlay’ and ‘clearfix’ CSS classes to MainNav to resolve render issue when no Cover image is provided.
Updating Big-Sample-Post to have no cover for validation

Resolves haysclark#18

* chore(release): 1.0.6

* fix: adding yarn.lock to fix install issues

Users installing the project with Yarn were missing a critical child dependancies for prismjs@1.9.0.

Resolves haysclark#21

* chore(release): 1.0.7

* chore: updating README with more specific install steps

* added import for prismjs css file to fix missing syntax highlighting

* fix: Adding local image for post cover example

Resolves haysclark#17

* chore: updating package-lock.json

* fix: ignoring linting error

- due to Prisma being added for Gatsby 2.0 support, we are ignoring this minor issue

* chore(release): 1.0.8

* BREAKING CHANGE: installed latest gatsby version [2.0.20]

* chore: updating yarn.lock

* refactor: installing retaled package updates

* refactor: missing 'prismjs' package needed for 'gatsby-transformer-remark' in v2

* refactor: change .babelrc to gatsby default

* refactor: moved layouts to components updated relative imports

* refactor: renamed index.jsx to layout.jsx and moved to components folder

* refactor: wrapped template pages without layout component

* refactor: changed 'children()' to 'children' in layout.jsx

* refactor: pass location to Layout component in all templates

* refactor: renamed id property of authors to uid | id seems to be a special proberty of nodes and messing with it breaks queries

* refactor: deprecated gatsby-link | removed package and updated imports

* refactor: explicit import of graphql tag

* refactor: Rename boundActionCreators to actions

* refactor: Rename pathContext to pageContext

* refactor: Change modifyWebpackConfig to onCreateWebpackConfig

* docs: Updating to reflect Gatsby 2.0 support

* chore: linting JS and most component CSS errors

- avoiding changes to layout.css for now

* chore(release): 2.0.0
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

3 participants