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 triying to use emotion on a Gatsby project.

See original GitHub issue

Current behavior:

When I try to run gatsby develop it give me this error

WebpackError: The @emotion/core package has been renamed to @emotion/react. Please import it like this import { jsx } from @emotion/react

But I have installed the emotion/core and the emotion/react my imports on the components are:

import React from 'react';
import { Link } from 'gatsby';
import Navegacion from './navegacion';
import { jsx, css } from '@emotion/react';

To reproduce:

https://codesandbox.io/s/emotion-issue-template-forked-7su4k?file=/src/navegacion.js

  1. run gatsby new project-name
  2. npm i @emotion/styled @emotion/react gatsby-plugin-emotion
  3. try to create a styled component

Expected behavior:

Expected behavior? I hope it works as it should, how it worked in older versions.

Environment information:

"dependencies": {
    "@emotion/core": "^11.0.0",
    "@emotion/react": "^11.1.1",
    "@emotion/styled": "^11.0.0",
    "gatsby": "^2.26.1",
    "gatsby-image": "^2.5.0",
    "gatsby-plugin-emotion": "^4.5.0",
    "gatsby-plugin-manifest": "^2.6.1",
    "gatsby-plugin-offline": "^3.4.0",
    "gatsby-plugin-react-helmet": "^3.4.0",
    "gatsby-plugin-sharp": "^2.8.0",
    "gatsby-source-filesystem": "^2.5.0",
    "gatsby-transformer-sharp": "^2.6.0",
    "prop-types": "^15.7.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-helmet": "^6.1.0"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Cretezycommented, Nov 30, 2020

After moving to gatsby-plugin-emotion@5.1.0-next.0 and using @emotion/react@11.1.1, I’m getting the following:

TypeError: can't access property "type", parent is null

node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js:69

image

0reactions
gabrandalissecommented, Dec 21, 2020

My problem was solved on the update of the gatsby plugin, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems with Emotion (Styled Components) on Gatsby
This is happening because in Emotion 11 the package names have changed. I don't believe gatsby-plugin-emotion is up to date yet, ...
Read more >
Troubleshooting Common Errors - Gatsby
Errors in styling. Inconsistent CSS styles between develop and build using styled-components or emotion. Errors with GraphQL. Unknown field 'A' on type 'B'....
Read more >
gatsby-plugin-manifest - npm
Gatsby plugin which adds a manifest.webmanifest to make sites progressive web apps. Latest version: 4.22.0, last published: 11 days ago. Start using ......
Read more >
Why you shouldn't use @emotion/core - Colin McDonnell
If you're using Emotion in your React project, @emotion/core is ... If you want to hear about that when it's ready, join my...
Read more >
[Gatsby, Storyblok] "Can't resolve 'fs' in x" - DEV Community ‍ ‍
Anyone who got the error says "Can't resolve 'fs' in x" from your Gatsby projects; Anyone who is trying out to arrange things...
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