Gatsby: Can't get markdown to work

Created on 6 Jan 2019  Â·  5Comments  Â·  Source: gatsbyjs/gatsby

Markdown is not working and gatsby develop gives me errors

I'm trying to get markdown to work on the website by following Adding markdown guide and the guide on Actions suggested in the errors (and a tutorial on Youtube).

Steps to reproduce

That's the repo with the problem: https://github.com/anabcrypto/abcrypto

Expected result

When I would click on the Read More section, the website shouldn't redirect me to a 404 error page.

Actual result

I get an error page.

Environment

System:
OS: Linux 4.19 Fedora 29 (Workstation Edition) 29 (Workstation Edition)
CPU: (4) x64 Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
Shell: 4.4.23 - /bin/bash
Binaries:
Node: 11.3.0 - ~/.nvm/versions/node/v11.3.0/bin/node
Yarn: 1.12.3 - /var/lib/snapd/snap/bin/yarn
npm: 6.5.0 - ~/.nvm/versions/node/v11.3.0/bin/npm
Languages:
Python: 2.7.15 - /usr/bin/python
Browsers:
Firefox: 64.0
npmPackages:
gatsby: ^2.0.85 => 2.0.85
gatsby-plugin-catch-links: ^2.0.9 => 2.0.9
gatsby-plugin-manifest: ^2.0.13 => 2.0.13
gatsby-plugin-offline: ^2.0.21 => 2.0.21
gatsby-plugin-react-helmet: ^3.0.5 => 3.0.5
gatsby-plugin-typography: ^2.2.4 => 2.2.4
gatsby-source-filesystem: ^2.0.12 => 2.0.12
gatsby-transformer-remark: ^2.1.19 => 2.1.19
npmGlobalPackages:
gatsby-cli: 2.4.8
gatsby: 2.0.85

error Couldn't find the required xsel binary. On Debian/Ubuntu you can install it with: sudo apt install xsel

Error: Couldn't find the required xsel binary. On Debian/Ubuntu you can inst all it with: sudo apt install xsel

  • envinfo.js:1 i
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:65651

  • envinfo.js:1 Object.copySync
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:66177

  • envinfo.js:1 Object.t.writeSync.e [as writeSync]
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:48777

  • envinfo.js:1
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46934

  • envinfo.js:1 Promise.all.then.e
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46949

  • util.js:16 tryCatcher
    [lib]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23

  • promise.js:512 Promise._settlePromiseFromHandler
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31

  • promise.js:569 Promise._settlePromise
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18

  • promise.js:614 Promise._settlePromise0
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  • promise.js:694 Promise._settlePromises
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

  • promise.js:638 Promise._fulfill
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18

  • promise_array.js:126 PromiseArray._resolve
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19

  • promise_array.js:144 PromiseArray._promiseFulfilled
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14

  • promise.js:574 Promise._settlePromise
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26

  • promise.js:614 Promise._settlePromise0
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  • promise.js:694 Promise._settlePromises
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

error UNHANDLED REJECTION

Error: Couldn't find the required xsel binary. On Debian/Ubuntu you can inst all it with: sudo apt install xsel

  • envinfo.js:1 i
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:65651

  • envinfo.js:1 Object.copySync
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:66177

  • envinfo.js:1 Object.t.writeSync.e [as writeSync]
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:48777

  • envinfo.js:1
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46934

  • envinfo.js:1 Promise.all.then.e
    [lib]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46949

  • util.js:16 tryCatcher
    [lib]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23

  • promise.js:512 Promise._settlePromiseFromHandler
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31

  • promise.js:569 Promise._settlePromise
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18

  • promise.js:614 Promise._settlePromise0
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  • promise.js:694 Promise._settlePromises
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

  • promise.js:638 Promise._fulfill
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18

  • promise_array.js:126 PromiseArray._resolve
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19

  • promise_array.js:144 PromiseArray._promiseFulfilled
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14

  • promise.js:574 Promise._settlePromise
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26

  • promise.js:614 Promise._settlePromise0
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  • promise.js:694 Promise._settlePromises
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

question or discussion

Most helpful comment

No problem at all, @omrllm

Feel free to open issues for anything else, we're here to help!

All 5 comments

Did you try installing xsel as suggested in the error log? If you did, what's the output of xsel --version?

Xsel gave me that error even before, but everything worked just fine.
I've installed it just to test, here are the results of gatsby info --clipboard now:

System:
OS: Linux 4.19 Fedora 29 (Workstation Edition) 29 (Workstation Edition)
CPU: (4) x64 Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
Shell: 4.4.23 - /bin/bash
Binaries:
Node: 11.3.0 - ~/.nvm/versions/node/v11.3.0/bin/node
Yarn: 1.12.3 - /var/lib/snapd/snap/bin/yarn
npm: 6.5.0 - ~/.nvm/versions/node/v11.3.0/bin/npm
Languages:
Python: 2.7.15 - /usr/bin/python
Browsers:
Firefox: 64.0
npmPackages:
gatsby: ^2.0.85 => 2.0.85
gatsby-plugin-catch-links: ^2.0.9 => 2.0.9
gatsby-plugin-manifest: ^2.0.13 => 2.0.13
gatsby-plugin-offline: ^2.0.21 => 2.0.21
gatsby-plugin-react-helmet: ^3.0.5 => 3.0.5
gatsby-plugin-typography: ^2.2.4 => 2.2.4
gatsby-source-filesystem: ^2.0.12 => 2.0.12
gatsby-transformer-remark: ^2.1.19 => 2.1.19
npmGlobalPackages:
gatsby-cli: 2.4.8
gatsby: 2.0.85

gatsby develop returned an error (this is not the full output of gatsby develop):

...
error gatsby-node.js returned an error

ReferenceError: id is not defined
...
warning Using the global graphql tag is deprecated, and will not be supported in v3.
Import it instead like: import { graphql } from 'gatsby' in file:
/home/ok/src/pages/blog.js
warning The GraphQL query in the non-page component "/home/ok/src/templates/blogTemplate.js" will not be run.
Exported queries are only executed for Page components. It's possible you're
trying to create pages in your gatsby-node.js and that's failing for some
reason.

If the failing component(s) is a regular component and not intended to be a page
component, you generally want to use a (https://gatsbyjs.org/docs/static-query)
instead of exporting a page query.

If you're more experienced with GraphQL, you can also export GraphQL
fragments from components and compose the fragments in the Page component
query and pass data down into the child component — http://graphql.org/learn/queries/#fragments
success extract queries from components — 0.079 s
success run graphql queries — 0.026 s — 7/7 283.11 queries/second
success write out page data — 0.004 s
success write out redirect data — 0.002 s
â „ onPostBootstrapdone generating icons for manifest
success onPostBootstrap — 0.181 s

info bootstrap finished - 4.983 s

Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .

Hey @omrllm

Just took a look at this. There are two issues here:

error gatsby-node.js returned an error
ReferenceError: id is not defined

In gatsby-node.js your call to createPage includes id in context which is undefined as the error above suggests

Because of this, the pages aren't getting created successfully and you're seeing the 404

Secondly, the file at /src/pages/sweet-pandas-eating-sweets.md doesn't have a path key in the front matter

I've fixed both of these and sent you a PR at https://github.com/anabcrypto/abcrypto/pull/1

Happy building with Gatsby!

I knew it wasn't a big thing, but I didn't know how to solve it.

I still have to learn a lot :+1:

Thank you very much @sidharthachatterjee!

No problem at all, @omrllm

Feel free to open issues for anything else, we're here to help!

Was this page helpful?
0 / 5 - 0 ratings