ui: [bug]: tw-animate-css Not Found When Adding New Components After Migration
Describe the bug
Description
After migration #6968 (feat(shadcn): replace tailwindcss-animate with tw-animate-css), users who had already installed the project before the migration and then added the sidebar component afterward are encountering the following error:
Error: Can't resolve 'tw-animate-css' in 'projectName/src/styles'
I checked my CSS file and noticed that a new line was added:
@import "tw-animate-css";
I think this happens because the migration introduced tw-animate-css, but users who had installed the project before the migration do not have this package installed by default.
Affected component/components
Sidebar
How to reproduce
- Have an existing project that was installed before migration #6968.
- Install a new component that now depends on tw-animate-css (e.g., sidebar).
- Run the project.
- Observe the error in the console.
Codesandbox/StackBlitz link
No response
Logs
System Info
Environment
Framework: Next.js
Tailwind CSS version: 4.0.0
Package manager: npm (version 11.1.0)
Before submitting
- I’ve made research efforts and searched the documentation
- I’ve searched for existing issues
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28
I was able to fix it by
npm install -D tw-animate-css@s69hub Restart your server, I also had the same issue now, after restarting my server, i longer got the error
@import “tw-animate-css” restart the server; they automatically resolve the error; I’m facing another error related to v4 tailwind CSS; actually, they can’t support my next.js project actually, they work on some pages, or some Can anybody help me with that
I merged the PR. Will tag a release soon.
I am also facing the same issue 😃
No, this isn’t working either way. I am using Docker with docker-compose for the ephemeral environmet, by the way.
Restarting server doesn’t, only fix is
npm install -D tw-animate-cssuntil @shadcn fixes thisI was able to fix it by npm install -D tw-animate-css
this is the real fix!
Restart your project