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: Cannot read property 'theme' of undefined #26337

Closed
phoshenwen opened this issue Jun 18, 2021 · 11 comments · Fixed by #35588
Closed

TypeError: Cannot read property 'theme' of undefined #26337

phoshenwen opened this issue Jun 18, 2021 · 11 comments · Fixed by #35588
Labels
examples Issue/PR related to examples good first issue Easy to fix issues, good for newcomers

Comments

@phoshenwen
Copy link

phoshenwen commented Jun 18, 2021

What example does this report relate to?

with-tailwindcss-emotion

What version of Next.js are you using?

11 | 10.2.3

What version of Node.js are you using?

14.17.1

What browser are you using?

Chrome & Firefox

What operating system are you using?

Win 10

How are you deploying your application?

n/a

Describe the Bug

Running "npm run dev" results in TypeError: Cannot read property 'theme' of undefined

Expected Behavior

Running "npm run dev" starts up the application without errors

To Reproduce

Following the instructions, I ran npx create-next-app --example with-tailwindcss-emotion with-tailwindcss-emotion-app, then npm run dev, then see error.

EDIT: Might relate to #25854 and #26012. The only tailwindcss version that works while disabling mode: "jit" is tailwindcss 2.1.4 (thanks for the pull request, @akellbl4 )

If this is considered a duplicate, please close/delete

@phoshenwen phoshenwen added bug Issue was opened via the bug report template. examples Issue/PR related to examples labels Jun 18, 2021
@timneutkens timneutkens added good first issue Easy to fix issues, good for newcomers and removed bug Issue was opened via the bug report template. labels Jun 20, 2021
@rickyrauch
Copy link

I disabled jit but it still doesn't work

@akellbl4
Copy link

As I can see the example doesn't work even in my PR. Tried to make a fast fix but had no luck.

You can try to use an example that uses emotion and tailwindcss with twin macro. Hope it'll be merged.

@pipboy3000
Copy link

I use tailwindcss 2.1.4 and disabled jit without any errors.

It seems that the error occurs from tailwind 2.2.0.

@ru88s
Copy link

ru88s commented Jun 29, 2021

I have same error.
I disabled jit and I use tailwindcss 2.1.4.
It still doesn't work.

@ru88s
Copy link

ru88s commented Jun 29, 2021

tailwindlabs/tailwindcss#4686

This solved the problem for me.
This was the second time I was stuck with this error.🥲

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
  // plugins: ['@tailwindcss/jit', 'autoprefixer']
};

@phoshenwen
Copy link
Author

@ru88s just to confirm, you're using tailwindcss 2.1.4 in your example and are proposing a fix for 2.1.4 only. This is NOT a fix for tailwind 2.2.x, and 2.2.x continues to NOT work.

Other than version bumping in the here referenced posts, no code base has changed and using tailwindcss 2.2.4 still won't run.

@samcx
Copy link
Member

samcx commented Jun 29, 2021

@phoshenwen This may be an issue with xwind, since @akellbl4 has an example working with twin.macro → #26060

@phoshenwen
Copy link
Author

@samsisle I can see this being an issue with Tailwindcss more so than Nextjs, only opened it here because the Nextjs example is not working out of the box. Once @akellbl4's pull request is merged this post can go away.

@rickyrauch
Copy link

tailwindlabs/tailwindcss#4686

This solved the problem for me.
This was the second time I was stuck with this error.🥲

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
  // plugins: ['@tailwindcss/jit', 'autoprefixer']
};

this was our fix! thanks a lot

@frankievalentine
Copy link

For anyone that didn't click on the pull request above from @irvile

From @ch4nd4n in Issue#27781

Downgrade tailwindcss to 2.1.4 in package.json
Comment out mode jit in tailwinds.config.js
Delete .next folder and reinstall dependencies

@kodiakhq kodiakhq bot closed this as completed in #35588 May 22, 2022
kodiakhq bot pushed a commit that referenced this issue May 22, 2022
Closes [#26337](#26337).
This PR fixes #26337.

The issue is just the version of xwind basically.
Not compatible with newer versions and jit mode.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples good first issue Easy to fix issues, good for newcomers
Projects
None yet
8 participants