Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: React.createContext is not a function #20

Closed
liuhe2020 opened this issue Sep 9, 2022 · 4 comments
Closed

TypeError: React.createContext is not a function #20

liuhe2020 opened this issue Sep 9, 2022 · 4 comments
Assignees

Comments

@liuhe2020
Copy link

Describe the bug

Server Error
TypeError: React.createContext is not a function

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack

file:///home/liu/Projects/Github-Hypnosis-Events/node_modules/yet-another-react-lightbox/dist/core/contexts/Events.js (3:29)
ModuleJob.run
internal/modules/esm/module_job.js (138:23)
async Loader.import
internal/modules/esm/loader.js (178:24)

Expected behavior

Plug and play

How to reproduce

Not sure, all I did was install the package, use code from example. Then I get this error.

Screenshots / Logs

No response

Additional context

No response

@liuhe2020 liuhe2020 added the bug Something isn't working label Sep 9, 2022
@igordanchenko
Copy link
Owner

igordanchenko commented Sep 9, 2022

Can you describe your environment?

node -v
tsc -v
npm ls --depth=0 react react-dom @types/react @types/react-dom @types/node typescript
cat tsconfig.json

Also, what framework / bundler are you using?

@liuhe2020
Copy link
Author

Using Next.js, so whatever the default is.

node v14.4.0
no tsc

├── autoprefixer@10.4.8
├── eslint-config-next@12.2.5
├── eslint@8.22.0
├── next@12.2.5
├── package-lock.json@1.0.0
├── postcss@8.4.16
├── react-dom@18.2.0
├── react-photo-album@1.16.1
├── react-spring-lightbox@1.7.0
├── react@18.2.0
├── tailwindcss@3.1.8
└── yet-another-react-lightbox@2.1.1

@igordanchenko
Copy link
Owner

Updating your node version will solve this error. Your are using node v14.4.0, which is pre-LTS version. The first LTS version in the v14 release was v14.15.0.

I'd recommend updating to either v14.20.0 or v16.17.0

@igordanchenko igordanchenko added the invalid This doesn't seem right label Sep 9, 2022
@liuhe2020
Copy link
Author

Great, many thanks for your time for this resolution and for making this amazing package!

@igordanchenko igordanchenko removed bug Something isn't working invalid This doesn't seem right labels Oct 11, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants