Error: Invalid hook call
See original GitHub issueCurrent 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:
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
- Clone the repository
- cd
/examples/basic
npm install
npm run styleguide
- open http://localhost:6060
Expected behavior
I expected the generated documentation to run.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a work around for anyone else who runs into this, it appears that installing
react@17.0.2
andreact-dom@17.0.2
works, but you have to force the install:Everything seems to work, but YMMV.
OK, in 5 I am doing a complete rewrite in vue3. We should not have this problem anymore 😉 No react, no trouble ^^