I followed the Gastby with Docz writing here: https://www.gatsbyjs.org/tutorial/writing-documentation-with-docz/. All configs were directly copied from the step-by-step instruction, but when I ran gatsby develop I got an error: Error: Cannot find module 'docz-core', I installed it and tried to load again, but this time I got another error: Error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type s tring. Received type undefined.
Followed the exact steps in here https://www.gatsbyjs.org/tutorial/writing-documentation-with-docz/ until this section:
Run the development server with gatsby develop and you should be greeted with the default Docz layout and a “Getting Started” heading. Stop the development server after verifying that everything works.
After running gatsby develop I got this error:
Error: Cannot find module 'docz-core'
Require stack:
- /Users/tingshang/Desktop/my-gatsby-site-with-docz/node_modules/gatsby-theme- docz/lib/utils/parseConfig.js
- /Users/tingshang/Desktop/my-gatsby-site-with-docz/node_modules/gatsby-theme- docz/gatsby-config.js
- /Users/tingshang/Desktop/my-gatsby-site-with-docz/node_modules/gatsby/dist/b ootstrap/get-config-file.js
- /Users/tingshang/Desktop/my-gatsby-site-with-docz/node_modules/gatsby/dist/b ootstrap/load-themes/index.js
- /Users/tingshang/Desktop/my-gatsby-site-with-docz/node_modules/gatsby/dist/b ootstrap/index.js
- /Users/tingshang/Desktop/my-gatsby-site-with-docz/node_modules/gatsby/dist/c ommands/develop.js
- /usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js
- /usr/local/lib/node_modules/gatsby-cli/lib/index.js
- loader.js:772 Function.Module._resolveFilename
internal/modules/cjs/loader.js:772:15
- loader.js:677 Function.Module._load
internal/modules/cjs/loader.js:677:27
- loader.js:830 Module.require
internal/modules/cjs/loader.js:830:19
- v8-compile-cache.js:159 require
[my-gatsby-site-with-docz]/[v8-compile-cache]/v8-compile-cache.js:159:20
- parseConfig.js:1 Object.<anonymous>
[my-gatsby-site-with-docz]/[gatsby-theme-docz]/lib/utils/parseConfig.js:1:11 1
- v8-compile-cache.js:178 Module._compile
[my-gatsby-site-with-docz]/[v8-compile-cache]/v8-compile-cache.js:178:30
- loader.js:947 Object.Module._extensions..js
internal/modules/cjs/loader.js:947:10
- loader.js:790 Module.load
internal/modules/cjs/loader.js:790:32
- loader.js:703 Function.Module._load
internal/modules/cjs/loader.js:703:12
- loader.js:830 Module.require
internal/modules/cjs/loader.js:830:19
- v8-compile-cache.js:159 require
[my-gatsby-site-with-docz]/[v8-compile-cache]/v8-compile-cache.js:159:20
- gatsby-config.js:2 Object.<anonymous>
[my-gatsby-site-with-docz]/[gatsby-theme-docz]/gatsby-config.js:2:27
- v8-compile-cache.js:178 Module._compile
[my-gatsby-site-with-docz]/[v8-compile-cache]/v8-compile-cache.js:178:30
- loader.js:947 Object.Module._extensions..js
internal/modules/cjs/loader.js:947:10
- loader.js:790 Module.load
internal/modules/cjs/loader.js:790:32
- loader.js:703 Function.Module._load
internal/modules/cjs/loader.js:703:12
I then ran npm install --save docz-core, and got this error:
UNHANDLED REJECTION The "path" argument must be of type string. Received type undefined
Error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type s tring. Received type undefined
- validators.js:112 validateString
internal/validators.js:112:11
- gatsby-config.js:58 module.exports
[my-gatsby-site-with-docz]/[gatsby-theme-docz]/gatsby-config.js:58:22
- index.js:73 resolveTheme
[my-gatsby-site-with-docz]/[gatsby]/dist/bootstrap/load-themes/index.js:73:1 9
- index.js:138
[my-gatsby-site-with-docz]/[gatsby]/dist/bootstrap/load-themes/index.js:138: 22
Successfully running on port 8000 and the default layout should show up.
Failed loading and terminal automatically exited.
System:
OS: macOS Mojave 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Languages:
Python: 3.7.4 - /Users/tingshang/opt/anaconda3/bin/python
Browsers:
Chrome: 79.0.3945.88
Firefox: 71.0
Safari: 12.0.2
npmPackages:
gatsby: ^2.18.12 => 2.18.12
gatsby-image: ^2.2.34 => 2.2.34
gatsby-plugin-manifest: ^2.2.31 => 2.2.31
gatsby-plugin-offline: ^3.0.27 => 3.0.27
gatsby-plugin-react-helmet: ^3.1.16 => 3.1.16
gatsby-plugin-sharp: ^2.3.5 => 2.3.5
gatsby-source-filesystem: ^2.1.40 => 2.1.40
gatsby-theme-docz: ^2.3.0-alpha.5 => 2.3.0-alpha.5
gatsby-transformer-sharp: ^2.3.7 => 2.3.7
npmGlobalPackages:
gatsby-cli: 2.8.22
Add "docz": "^2.2.0" to your package.json
@tcope25
Thanks a lot for getting back! I checked your PR and it seems only npm install --save docz@latest gatsby-theme-docz@latest worked for me. Changing onlygatsby-theme-docz to lastest still gave me this error Error: Cannot find module 'docz-core' somehow.
A follow up question after this: the default Docz layout and a “Getting Started” heading as described in the doc didn't happen to me. Although I noticed the index.mdx is routed to /, the homepage is still whatever setup in src/pages/index.js. I wonder how are we able to configure so index.mdx could show up correctly? Thanks again for your help on this matter!
@gracegotlost According to https://www.docz.site/docs/gatsby-theme you _do_ need to install docz as well since the theme has it set to a peer dependency i https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/package.json
Want to open a PR adding that in?
Regarding your follow up question, want to open an issue about that in https://github.com/doczjs/docz?
Most helpful comment
Add
"docz": "^2.2.0"to yourpackage.json