styled-components / styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
https://styled-components.com
MIT License
40.12k stars 2.48k forks source link

Error while building project after upgrading from 5.3.11 to 6.0.0 #4290

Closed cristinastan97 closed 1 month ago

cristinastan97 commented 1 month ago

Environment

## System:
 - OS: Windows 11 10.0.22631
 - CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
 - Memory: 3.73 GB / 15.74 GB
## Binaries:
 - Node: 16.10.0 - C:\Program Files\nodejs\node.EXE
 - Yarn: 1.22.19 - ~\Documents\my-app\packages\next-js\node_modules\.bin\yarn.CMD
 - npm: 7.24.0 - C:\Program Files\nodejs\npm.CMD
## npmPackages:
 - styled-components: ^6.0.0 => 6.1.8

Expected Behavior

I would expect to build with no errors

Actual Behavior

After upgrading to 6.0.0 I receive this error

error - ./node_modules/next/dist/client/dev/amp-dev.js
Error: Cannot find module 'babel-plugin-styled-components'  

In .babelrc I have the following

{
  "presets": ["next/babel"],
  "plugins": [["styled-components", { "ssr": true }]]
}

I've looked over the documentation and breaking changes and it doesn't say anything about this plugin

yzhou-willow commented 1 month ago

I had the same problem, resolved by adding installation of babel-plugin-styled-components into the package.json

cristinastan97 commented 1 month ago

Thank you, that worked