docz: Stuck trying to run docz dev

Just tried docz rc 1.0.0 rc3 and got the following multiple instances of error:

✖ fatal Error parsing static types ✖ error Error: No suitable component definition found. at parse (/Users/bugzpodder/ui/node_modules/docz-core/node_modules/react-docgen/dist/parse.js:70:13) at Object.defaultParse [as parse] (/Users/bugzpodder/ui/node_modules/docz-core/node_modules/react-docgen/dist/main.js:64:29) at resolve (/Users/bugzpodder/ui/node_modules/docz-core/dist/index.js:1412:38) at new Promise (<anonymous>) at jsParser (/Users/bugzpodder/ui/node_modules/docz-core/dist/index.js:1409:12) at Promise.all.files.map (/Users/bugzpodder/ui/node_modules/docz-core/dist/index.js:1430:15) at Array.map (<anonymous>) at docgen (/Users/bugzpodder/ui/node_modules/docz-core/dist/index.js:1427:42)

Turning debug: off and the UI is stuck at this: ● Docz █████████████████████████ building (10%) 2/4 modules 2 active …/node_modules/url/url.js

After about 5 minutes I get a build success with the following UI error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
  10 |   useDataServer('ws://127.0.0.1:60505')
  11 |   return (
  12 |     <Theme linkComponent={Link} db={database}>
> 13 |       <Routes imports={imports} />
     |      ^  14 |     </Theme>
  15 |   )
  16 | }
  11 | const root = document.querySelector('#root')
  12 | const render = (Component = Root) => {
  13 |   onPreRender()
> 14 |   ReactDOM.render(<Component />, root, onPostRender)
     |  ^  15 | }
  16 | 
  17 | render(Root)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 25
  • Comments: 26 (4 by maintainers)

Most upvoted comments

same issue

After trying all of the above, I also found that upgrading to V1 results in the same stack trace no matter how I fix versions of React, etc.


● Docz █████████████████████████ building (11%) 9/16 modules 7 active
 node_modules/docz-core/node_modules/webpack-dev-server/client/overlay.js


<--- Last few GCs --->

[7187:0x10276f000]    28993 ms: Scavenge 1389.3 (1422.5) -> 1388.9 (1423.0) MB, 2.2 / 0.0 ms  (average mu = 0.093, current mu = 0.039) allocation failure 
[7187:0x10276f000]    28996 ms: Scavenge 1389.6 (1423.0) -> 1389.2 (1423.5) MB, 2.2 / 0.0 ms  (average mu = 0.093, current mu = 0.039) allocation failure 
[7187:0x10276f000]    29000 ms: Scavenge 1389.9 (1423.5) -> 1389.5 (1424.5) MB, 2.4 / 0.0 ms  (average mu = 0.093, current mu = 0.039) allocation failure 


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x14a3e9a4fc7d]
Security context: 0x3042e899d949 <JSObject>
    1: getMembers(aka getMembers) [0x3042a4ca4ef9] [/Users/simon.bailey/src/web-ui/node_modules/react-docgen/dist/utils/getMembers.js:~43] [pc=0x14a3ea33dc3e](this=0x3042c9e825b1 <undefined>,0x3042b2f35bc1 <NodePath map = 0x3042a6c16111>,0x3042c9e82741 <true>)
    2: getPropType(aka getPropType) [0x3042dec3fd21] [/Users/simon.bailey/src/web-ui/node_modules/r...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100062991 node::Abort() [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 2: 0x100063030 node::errors::TryCatchScope::~TryCatchScope() [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 3: 0x10019cf37 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 4: 0x10019ced4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 5: 0x1005a2032 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 6: 0x1005a4563 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 7: 0x1005a0a98 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 8: 0x10059ec55 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
 9: 0x1005ab4fc v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
10: 0x1005ab57f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
11: 0x10057a774 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
12: 0x10082cc94 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/simon.bailey/.nvm/versions/node/v11.7.0/bin/node]
13: 0x14a3e9a4fc7d 

How I & @alexhawkins fixed it

My situation was that I have a monorepo that’s managed by npm scripts, no monorepo tool like Lerna.

I have a frontend folder that contains all of our Gatsby apps. The frontend repo package.json has

  "resolutions": {
    "react": "^16.8.6",
    "react-dom": "^16.8.6"
  },
"dependencies" : {
    "react": "16.8.6",
    "react-dom": "16.8.6"
},
  "devDependencies": {
    "docz": "^1.0.4",
    "docz-theme-default": "^1.0.4"
}
  1. Add .docz to .gitignore
  2. In frontend folder, rm -rf node_modules package-lock.json .docz
  3. In frontend folder, npm i
  4. In frontend folder, docz dev

Should work out. For people reading this in the future, your react dependencies might have to match up with whatever React version is in https://github.com/pedronauck/docz/blob/master/core/docz/package.json

I’m still having this issue. If I install Docz in my React app, I get more than one copy of React in the same app:

Screen Shot 2020-06-01 at 12 46 56 PM

I tried using npm force-resolutions and it does not solve this issue in my case.

I’ve noticed that Docz uses the following versions of react and react-dom: “react”: “^16.8.0”, “react-dom”: “^16.8.0”

And my project is using 16.13.1, could this be the issue?

Please any help would be very much appreciated!

Any updates on this? I too tried pinning react to 16.8.6, removed node_modules and package-lock.json to get deduped react versions, but still encounter this error

Ran into this today and looked in the package.json file for Docz. I saw that the React typings they are using is for ^16.8.2. I was using React ^16.8.3 for the project I have Docz on.

Make sure you’re running the following versions of React in the project you have Docz on:

    "react": "^16.8.2",
    "react-dom": "^16.8.2",

After that, blast away the .docz folder and node_modules. Finally, re-install node_modules and run docz and you should be good!

What’s interesting is that I don’t see any peer dependencies stating the version of React that needs to be installed to run the project. @pedronauck Happy to put in a PR to update the Readme and add the specific React version to the package.json.

Hey @wldcordeiro

V2 will get out of RC status next Monday November 25.

Did you give it a try ?

I encourage you to try it and if you face any problems we’ll be happy to help ! Or feel free to wait for next week 👍

@pedronauck It doesn’t.
I pinned my react to 16.8.2 in package.json and docz automatically installs 16.8.6 so now I have two versions of react installed (according to yarn why) I changed my react to 16.8.6 and now there is only one version but it still won’t stack with the same errors above.

I get this problem on latest of the v1 releases. Seeing as v2 seems to have stalled out on the infinite RC status I worry about this package stability for either major version.

What @mwood23 told should fix this problem.