adminjs: Error on the login page using the latest version of admin-bro
Describe the bug I’m having an issue when trying to load the login page. On the server side I’m getting this error: `node:9956) UnhandledPromiseRejectionWarning: 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:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- 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.
at resolveDispatcher (/home/tim/WebstormProjects/selkni/node_modules/admin-bro/node_modules/react/cjs/react.development.js:1465:13)
at Object.useState (/home/tim/WebstormProjects/selkni/node_modules/admin-bro/node_modules/react/cjs/react.development.js:1496:20)
at ae (/home/tim/WebstormProjects/selkni/node_modules/admin-bro/node_modules/styled-components/dist/styled-components.cjs.js:1:13232)
at processChild (/home/tim/WebstormProjects/selkni/node_modules/react-dom/cjs/react-dom-server.node.development.js:3043:14)
at resolve (/home/tim/WebstormProjects/selkni/node_modules/react-dom/cjs/react-dom-server.node.development.js:2960:5)
at ReactDOMServerRenderer.render (/home/tim/WebstormProjects/selkni/node_modules/react-dom/cjs/react-dom-server.node.development.js:3435:22)
at ReactDOMServerRenderer.read (/home/tim/WebstormProjects/selkni/node_modules/react-dom/cjs/react-dom-server.node.development.js:3373:29)
at renderToString (/home/tim/WebstormProjects/selkni/node_modules/react-dom/cjs/react-dom-server.node.development.js:3988:27)
at html (/home/tim/WebstormProjects/selkni/node_modules/admin-bro/lib/frontend/login-template.js:71:53)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use
node --trace-warnings ...to show where the warning was created) (node:9956) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) `
Installed libraries and their versions
"@admin-bro/design-system": "^1.7.0",
"@admin-bro/express": "^3.0.1",
"@admin-bro/typeorm": "^1.3.0",
"@admin-bro/upload": "^1.0.0",
"react-dom": "=16.13.1",
"admin-bro": "^3.3.1",
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 21 (7 by maintainers)
installing react fixed it for me
I solved the issue by adding react as a dependency.