question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Invalid hook call

See original GitHub issue

Current behavior

When attempting to add vue-styleguidist to my project or run any of the examples, after getting the ‘Compiled successfully!’ message, navigating to http://localhost:6060/ yields:

image

It looks to be related to these warnings when running npm install:

> npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from vue-styleguidist@4.40.0
npm WARN   node_modules/vue-styleguidist
npm WARN     dev vue-styleguidist@"^4.36.1" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@">=15.5 <=16.x" from react-codemirror2@7.2.1
npm WARN node_modules/react-codemirror2
npm WARN   react-codemirror2@"^7.2.1" from vue-styleguidist@4.40.0
npm WARN   node_modules/vue-styleguidist
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   react@"^17.0.2" from vue-styleguidist@4.40.0
npm WARN   node_modules/vue-styleguidist
npm WARN     dev vue-styleguidist@"^4.36.1" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.0.0" from react-simple-code-editor@0.11.0
npm WARN node_modules/react-simple-code-editor
npm WARN   react-simple-code-editor@"^0.11.0" from vue-styleguidist@4.40.0
npm WARN   node_modules/vue-styleguidist
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react-dom@17.0.2
npm WARN node_modules/react-dom
npm WARN   react-dom@"^17.0.2" from vue-styleguidist@4.40.0
npm WARN   node_modules/vue-styleguidist
npm WARN     dev vue-styleguidist@"^4.36.1" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@"^16.0.0" from react-simple-code-editor@0.11.0
npm WARN node_modules/react-simple-code-editor
npm WARN   react-simple-code-editor@"^0.11.0" from vue-styleguidist@4.40.0
npm WARN   node_modules/vue-styleguidist
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 1287 packages, and audited 1288 packages in 15s

93 packages are looking for funding
  run `npm fund` for details

13 vulnerabilities (11 moderate, 2 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

To reproduce

  1. Clone the repository
  2. cd /examples/basic
  3. npm install
  4. npm run styleguide
  5. open http://localhost:6060

Expected behavior

I expected the generated documentation to run.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
Morgulcommented, Jun 24, 2021

As a work around for anyone else who runs into this, it appears that installing react@17.0.2 and react-dom@17.0.2 works, but you have to force the install:

> npm install react@17.0.2 react-dom@17.0.2 --force

Everything seems to work, but YMMV.

3reactions
elevatebartcommented, Jun 24, 2021

OK, in 5 I am doing a complete rewrite in vue3. We should not have this problem anymore 😉 No react, no trouble ^^

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid Hook Call Warning - React
Invalid Hook Call Warning ... You are probably here because you got the following error message: Hooks can only be called inside the...
Read more >
Invalid hook call. Hooks can only be called inside of the body ...
I want to show some records in a table using React but I got this error: Invalid hook call ...
Read more >
Invalid hook call. Hooks can only be called inside the body of ...
The error "Invalid hook call. Hooks can only be called inside the body of a function component" occurs for multiple reasons, having a...
Read more >
Invalid hook call - How to resolve multiple versions of React ...
Invalid hook call ? If you've seen this and are trying to solve it, here's a quick tip to make your life easier...
Read more >
Invalid hook call error - Shakacode
react.development.js:1465 Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found