doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.55k stars 1.46k forks source link

Error on HelloWorld.mdx startup in React-boilerplate: Cannot query field "doczDb" on type "Query". #1658

Open sophyphreak opened 2 years ago

sophyphreak commented 2 years ago

Bug Report

Describe the bug

When I try to follow the getting started documentation, I get an error:

TypeError: repo.browsetemplate.replace is not a function
    at getRepoEditUrl (C:\Users\ahorn\code\react-boilerplate\node_modules\docz-core\dist\index.js:772:63)
    at new Entries (C:\Users\ahorn\code\react-boilerplate\node_modules\docz-core\dist\index.js:1287:24)
    at Object.module.exports (C:\Users\ahorn\code\react-boilerplate\node_modules\gatsby-theme-docz\lib\sourceNodes.js:18:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at runAPI (C:\Users\ahorn\code\react-boilerplate\node_modules\gatsby\src\utils\api-runner-node.js:485:16)

 ERROR #11321  PLUGIN

"gatsby-theme-docz" threw an error while running the sourceNodes lifecycle:

repo.browsetemplate.replace is not a function

  TypeError: repo.browsetemplate.replace is not a function

  - index.js:745 getRepoUrl
    [react-boilerplate]/[docz-core]/dist/index.js:745:62

  - index.js:783 getInitialConfig
    [react-boilerplate]/[docz-core]/dist/index.js:783:19

  - index.js:817 Object.state [as config]
    [react-boilerplate]/[docz-core]/dist/index.js:817:19

  - sourceNodes.js:23 Object.module.exports
    [react-boilerplate]/[gatsby-theme-docz]/lib/sourceNodes.js:23:12

  - runMicrotasks

  - task_queues.js:95 processTicksAndRejections
    internal/process/task_queues.js:95:5

  - api-runner-node.js:485 runAPI
    [react-boilerplate]/[gatsby]/src/utils/api-runner-node.js:485:16

warn The gatsby-theme-docz plugin has generated no Gatsby nodes. Do you need it?

Full console print out here.

To Reproduce

Repo with a reproduction of the issue here.

Simply clone, run npm i && npm run docz:dev to reproduce error.

You can also replicate on your own by following the following steps:

  1. Clone react-boilerplate from here.
  2. Run cd react-boilerplate.
  3. Run npm run setup.
  4. Run npm i docz
  5. Add "docz:dev": "docz dev" as script in package.json.
  6. Add index.mdx to project.
  7. Run npm run docz:dev
  8. See error in console and in brower.

Expected behavior

I expect docz to render correctly.

Environment

Additional context/Screenshots N/A

matheuspoleza commented 2 years ago

Hey @sophyphreak thanks for bringing it up. I could reproduce the error here, but one thing that I noticed is that I got a peer-dependency error while installing docz in that project.

It seems connected-react-router is using v16.4.0 react version. How did you manage that? Did you force npm to skip it?

It would be nice to first of all open an issue in https://github.com/react-boilerplate/react-boilerplate addressing that issue. Could you handle that first? So we can make sure the issue is not related to conflicting react versions.