gatsby: Gatsby develop command error

Hi everyone, I just created a new Gatsby project for a client. I just ran these following commands gatsby new mynewproject cd mynewproject gatsby develop

Until here, nothing wrong. But when i’m on localhost:8000 I have this error message :

TypeError: Cannot read property ‘jsonName’ of undefined

I tried several time to delete the folder and reinstall Gatsby but I can’t fix this issue.

fireshot capture 3 - - http___localhost_8000_

What can I do in order to solve this issue ??

Thank in advance for your help.

Have a great day.

Maral

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 49 (24 by maintainers)

Most upvoted comments

Ehmmm, yeah… I reported that one month ago didn‘t I?

@rdela It finally works, thanks a lot !!!

Thanks for describing your encounter with this error @anttti!

@MaralS does this hold true for your case? If so, would you try moving the project(s) directories to a path with only alphanumeric characters, underscores, and hyphens (a-z, 0-9, _, and - itself) and see if that solves for now?

From your earlier error: https://github.com/gatsbyjs/gatsby/issues/3183#issuecomment-370128994

[...]
d:\Maral Sabbagh\Documents\Personnel\Projets\Maral_Sabbagh\Développement\gatsby-boilerplate\
[...]

Looks like Développement would be the culprit. Could you add a new directory, dev, or something without an accent or any other diacritics under Maral_Sabbagh and move gatsby-boilerplate there (or clone source again, gatsby new, whatever you were doing before, or whatever is easiest if you do not want to move gatsby-boilerplate), see if that works and report back when you can?

If it does work, hoping this is a temporary fix and we can get Gatsby working on any path that should work on Windows soon.

Cc @szimek @LeKoArts @KyleAMathews

Ran into this issue today while hosting a workshop for local students. On Windows, if the project is under a path that has non-[a-zA-Z0-9] letters (in our case, the letter ‘ä’), this problem occurs.

@MaralS Yeah, it’s probably something similar to the layout issue, where the glob pattern was working on Mac and Linux, but not on Windows. I’ll try to find some time till the end of this week to set up Windows VM again and see if I can reproduce this error.

The problem is solved! It is related to being a permission issue on Windows Machines. Installing Gatsby on a other drive or folder which does not need permission so NOT Program Files will solve the problem!

I first checked that one but my problem wasn’t resolved by that. But my folder had ä,ö,ü in the name… After removing these letters it worked.

Maybe that helps! 😃

@KyleAMathews

I’ve just encountered the same error, but it was my mistake. When calling createPage in gatsby-node.js I’m passing layout name based on locale parameter coming from a query, but I forgot to create layout files for all supported locale. So it was trying to find a layout with id de but failed, because there was no such file in src/layouts.

So it looks like there are 2 similar issues:

  • it would be great to add more meaningful error message when a layout can’t be found
  • on some systems, most likely because of some permissions issues in node-glob package, layouts files can’t be found and thus it fails to find any layout

The first issue could be solved by throwing an error if a layout can’t be found in pages-writer.js#L45-L49 and then catching rejected promise in https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/bootstrap/index.js#L360

I can create a PR for that, but I’m not sure though if error reporting is done simply using console.log or by some other mechanism.

The second issue could be solved by adding some check after generating new Gatsby project to see if at least the default index layout can be found.

While it sucks a bit, if it’s really caused by this permissions issue, maybe Gatsby could check file permissions when creating a new app and report an error/warning if they are incorrect (whatever it actually means) and could break node-glob?

OS: Windows 10 64-bit Node: 8.9.4 Yarn: 1.3.2 Gatsby: 1.9.157

Followed the exact steps on the Gatsby website, installed the Gatsby CLI and then ran the commands as shown.

Your environment has been set up for using Node.js 8.9.4 (x64) and npm.

C:\Users\Ravindre>cd C:\Program Files (x86)\Ampps\www

C:\Program Files (x86)\Ampps\www>gatsby new gatsby-site
info Creating new site from git: git://github.com/gatsbyjs/gatsby-starter-default.git
Cloning into 'gatsby-site'...
remote: Counting objects: 700, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 700 (delta 7), reused 16 (delta 4), pack-reused 679
Receiving objects: 100% (700/700), 661.25 KiB | 1.00 MiB/s, done.
Resolving deltas: 100% (403/403), done.
success Created starter directory layout
info Installing packages...
yarn install v1.3.2
info No lockfile found.
[1/4] Resolving packages...
warning gatsby > babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "gatsby > postcss-cssnext@2.11.0" has unmet peer dependency "caniuse-db@^1.0.30000652".
warning " > react-helmet@5.2.0" has unmet peer dependency "react@>=15.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 15.99s.

C:\Program Files (x86)\Ampps\www>cd C:\Program Files (x86)\Ampps\www\gatsby-site

C:\Program Files (x86)\Ampps\www\gatsby-site>gatsby develop
success delete html files from previous builds — 0.007 s
success open and validate gatsby-config.js — 0.005 s
success copy gatsby files — 0.025 s
success onPreBootstrap — 0.005 s
success source and transform nodes — 0.022 s
success building schema — 0.093 s
success createLayouts — 4.484 s
success createPages — 3.173 s
success createPagesStatefully — 6.130 s
success onPreExtractQueries — 0.001 s
success update schema — 0.055 s
success extract queries from components — 0.438 s
success run graphql queries — 0.637 s
error UNHANDLED REJECTION

  TypeError: Cannot read property 'jsonName' of undefined

  - pages-writer.js:79
    [gatsby-site]/[gatsby]/dist/internal-plugins/query-runner/pages-writer.js:79:36

  - Array.forEach

  - next_tick.js:131 _combinedTickCallback
    internal/process/next_tick.js:131:7

  - next_tick.js:180 process._tickCallback
    internal/process/next_tick.js:180:9