doczjs / docz

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

docz dev error #1626

Closed markgong-gd closed 3 years ago

markgong-gd commented 3 years ago

Bug Report

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Please try to build a small repo with a repro of your problem and provide a link to it.

Doing that allows more people to quickly help you.

If you can't provide a repo then provide clear steps describing how to reproduce the issue.

  1. npm install docz && mkdir doczrc.js
    // doczrc.js
    export default {
    dest: 'doc-site',
    title: 'rc-ui',
    typescript: true,
    };
  2. src/index.mdx
---
name: Getting Started
route: /
---

# Getting Started

Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications.

Regardless of the technologies and tools behind them, a successful design system follows these guiding principles:

- **It’s consistent**. The way components are built and managed follows a predictable pattern.
- **It’s self-contained**. Your design system is treated as a standalone dependency.
- **It’s reusable**. You’ve built components so they can be reused in many contexts.
- **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web.
- **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs.

## Consistency

Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system.
  1. npm run docz dev
  2. See error in browser

There was an error in your GraphQL query: Cannot query field "doczDb" on type "Query".

If you don't expect "doczDb" to exist on the type "Query" it is most likely a typo. However, if you expect "doczDb" to exist there are a couple of solutions to common problems:

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: E:/self/rc-ui/node_modules/gatsby-theme-docz/src/hooks/useDbQuery.js

FOR BUGS: Insert debug trace

Expected behavior

A clear and concise description of what you expected to happen..

Environment

Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.

vinimarcili commented 3 years ago

I have the same error! Up!

yunusture commented 3 years ago

Is there any update here ? Anybody has any solution ?

renatobenks commented 3 years ago

Hey everyone! That's actually super weird happening here, because doczDb is definitely something expected to docz core properly create dynamically the gatsby project for you. This actually is expected to be done in pre-build stage, so it's possible that a message has been shown on the build process, maybe telling what happened. This error is happening in runtime, right?

Then, can you provide a complety snapshot of your entire log after run docz build @markgong-gd?

renatobenks commented 3 years ago

Exactly the same thing is happening from your side @yunusture? Let me know, please. So we can try to help you guys ASAP.

I believe as many details as you have, and share, faster it'll be solved 🙂

Even because, this is an important one, so as long as we can reproduce it, we probably will find out how to fix it.

rizikolik commented 3 years ago

@renatobenks ,Hi and thanks for response :) I have an ongoing project which we want to provide some documentation. Inside the project,I run yarn add docz and After that I am adding the scripts for running the docz. My project uses the latest react 17. And at first I thought that is the problem but no.Now I changed my react and react-dom versions to 16.12 and still same errors happening.Here My steps and logs : 1) yarn add docz 2) add "docz:dev": "docz dev","docz:build": "docz build", "docz:serve": "docz build && docz serve" scripts. 3) yarn docz:dev . 4) logs after these commands:

` yarn install v1.22.10 [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.3.2: The platform "linux" is incompatible with this module. info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.2.13: The platform "linux" is incompatible with this module. info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning " > docz@2.3.1" has incorrect peer dependency "react@^16.8.0". warning " > docz@2.3.1" has incorrect peer dependency "react-dom@^16.8.0". warning "docz > gatsby-plugin-eslint@2.0.8" has incorrect peer dependency "eslint@^6.6.0". warning "docz > gatsby-plugin-eslint@2.0.8" has unmet peer dependency "eslint-loader@^3.0.2". warning "docz > gatsby-theme-docz@2.3.1" has incorrect peer dependency "react@^16.8.0". warning "docz > gatsby-theme-docz@2.3.1" has incorrect peer dependency "react-dom@^16.8.0". warning "docz > gatsby > @reach/router@1.3.4" has incorrect peer dependency "react@15.x || 16.x || 16.4.0-alpha.0911da3". warning "docz > gatsby > @reach/router@1.3.4" has incorrect peer dependency "react-dom@15.x || 16.x || 16.4.0-alpha.0911da3". warning "docz > gatsby-theme-docz > react-resize-detector@4.2.3" has incorrect peer dependency "react@^16.0.0". warning "docz > gatsby-theme-docz > react-resize-detector@4.2.3" has incorrect peer dependency "react-dom@^16.0.0". warning "docz > gatsby-theme-docz > theme-ui@0.2.52" has incorrect peer dependency "react@^16.8.0". warning "docz > gatsby > @reach/router > create-react-context@0.3.0" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0". warning "docz > gatsby-theme-docz > react-live > react-simple-code-editor@0.10.0" has incorrect peer dependency "react@^16.0.0". warning "docz > gatsby-theme-docz > react-live > react-simple-code-editor@0.10.0" has incorrect peer dependency "react-dom@^16.0.0". warning "docz > gatsby-theme-docz > rehype-docz > react-ace@7.0.5" has incorrect peer dependency "react@^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0". warning "docz > gatsby-theme-docz > rehype-docz > react-ace@7.0.5" has incorrect peer dependency "react-dom@^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0". [4/4] Building fresh packages... $ node ./node_modules/husky/lib/bin install husky - Git hooks installed Done in 16.37s. yarn run v1.22.10 $ docz dev --port 1337

Building app info We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users and your site was automatically chosen as one of them. With your help, we'll then release them to everyone in the next minor release.

We greatly appreciate your help testing the change. Please report any feedback good or bad in the umbrella issue. If you do encounter problems, please disable the flag by setting it to false in your gatsby-config.js like:

flags: { THE_FLAG: false }

The following flags were automatically enabled on your site:

success open and validate gatsby-configs - 0.878s success load plugins - 0.409s success onPreInit - 0.047s success initialize cache - 0.018s success copy gatsby files - 0.089s success onPreBootstrap - 0.051s success createSchemaCustomization - 0.003s TypeError: repo.browsetemplate.replace is not a function at getRepoEditUrl (/user/node_modules/docz-core/dist/index.js:772:63) at new Entries (/user/node_modules/docz-core/dist/index.js:1287:24) at Object.module.exports (/user/node_modules/gatsby-theme-docz/lib/sourceNodes.js:18:19) at processTicksAndRejections (node:internal/process/task_queues:93:5) at runAPI (/user/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

warn The gatsby-theme-docz plugin has generated no Gatsby nodes. Do you need it? success Checking for changed pages - 0.001s success source and transform nodes - 0.691s success building schema - 0.324s info Total nodes: 72, SitePage nodes: 1 (use --verbose for breakdown) success createPages - 0.008s success Checking for changed pages - 0.002s

ERROR #85923 GRAPHQL

There was an error in your GraphQL query:

Cannot query field "allDoczEntries" on type "Query".

If you don't expect "allDoczEntries" to exist on the type "Query" it is most likely a typo. However, if you expect "allDoczEntries" to exist there are a couple of solutions to common problems:

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: ../node_modules/gatsby-theme-docz/lib/createPagesStatefully.js:28:10

success createPagesStatefully - 0.128s success update schema - 0.027s success write out redirect data - 0.002s success onPostBootstrap - 0.004s info bootstrap finished - 4.995s success onPreExtractQueries - 0.002s

ERROR #85923 GRAPHQL

There was an error in your GraphQL query:

Cannot query field "doczDb" on type "Query".

If you don't expect "doczDb" to exist on the type "Query" it is most likely a typo. However, if you expect "doczDb" to exist there are a couple of solutions to common problems:

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: ../node_modules/gatsby-theme-docz/src/hooks/useDbQuery.js:7:9

failed extract queries from components - 0.085s success write out requires - 0.004s success run page queries - 0.028s - 2/2 71.61/s ⠀ You can now view docz-app in the browser. ⠀ http://localhost:1337/ ⠀ View GraphiQL, an in-browser IDE, to explore your site's data and schema ⠀ http://localhost:1337/___graphql ⠀ Note that the development build is not optimized. To create a production build, use gatsby build ⠀ success Building development bundle - 12.103s info changed file at /user/package.json info changed file at /user/package.json success building schema - 0.302s info Total nodes: 74, SitePage nodes: 3 (use --verbose for breakdown) success createPages - 0.007s success Checking for changed pages - 0.003s success update schema - 0.039s success onPreExtractQueries - 0.002s

ERROR #85923 GRAPHQL

There was an error in your GraphQL query:

Cannot query field "doczDb" on type "Query".

If you don't expect "doczDb" to exist on the type "Query" it is most likely a typo. However, if you expect "doczDb" to exist there are a couple of solutions to common problems:

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query": https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

File: ../node_modules/gatsby-theme-docz/src/hooks/useDbQuery.js:7:9

failed extract queries from components - 0.044s success write out requires - 0.002s`

rizikolik commented 3 years ago

@renatobenks also same , when I change my react and react-dom version to "^16.8.0".

rizikolik commented 3 years ago

Also I am using linux and when I run npx create-docz-app my-docz-app , I got differant errors : ` Creating a new Docz app in /home/ynsture/Desktop/Development/my-docz-app.

Downloading files for example basic. This might take a moment.

Aborting installation. Unexpected error. Please report it as a bug: TypeError: e.destroy is not a function at /home/ynsture/.npm/_npx/f6e6de91721365f0/node_modules/create-docz-app/dist/index.js:2:35630 at Array.forEach () at /home/ynsture/.npm/_npx/f6e6de91721365f0/node_modules/create-docz-app/dist/index.js:2:35573 at processTicksAndRejections (node:internal/process/task_queues:93:5) at async Promise.all (index 0)

npm ERR! code 1 npm ERR! path /home/ynsture/Desktop/Development npm ERR! command failed npm ERR! command sh -c create-docz-app my-docz-app

npm ERR! A complete log of this run can be found in:`

renatobenks commented 3 years ago

Hmm, thanks for sharing it in such detail, it'll be helpful! This will take some investigation to reproduce and see what's happening. But in case you be able to create a reproducible environment in a repo, or even in a codesandbox for example, would be nice!

rizikolik commented 3 years ago

@renatobenks here the sandbox :https://stackblitz.com/edit/node-nbg3zf?file=public%2Findex.html . Hope you can fix it .

renatobenks commented 3 years ago

Awesome! Yes, sure, we'll fix it!

renatobenks commented 3 years ago

Hey, everyone having this issue, it actually happens when you don't have any markdown file to be reached and parsed by docz to build your site. So, even though it's not ideally expected, obviously, if you just add some component markdown file in your codebase, you can pick some example from our docs, or getting started, it'll probably gonna work.

Either way, I'm writing a workaround to avoid this issue for good, and stop people of struggle on that without understanding what actually it's happening.

So, I'm closing this issue for now, but let me know guys you're experiencing something different than this.