版本问题,如果是安装3 版本的,需要安装 3 个东西,有postcss等,但是按照官网说的方法去执行上面的命令,总是失败,有可能是版本冲突,都更新到最新版或允许以解决。
查看版本:
npm list tailwindcss
npm list tailwindcss
复制代码
或许如下是比较合适的:
2.是否要安装的@tailwindcss/postcss的问题
我因为项目内引入了shadcn,需要版本 4 的,安装后总是会提示postcss等等的问题,实在终归是版本冲突,所以要找最新的官网版本,一步一步按照流程进行,多试几次就好。比如这种报错:
[postcss] It looks like you're trying to use `tailwindcss` directly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install `@tailwindcss/postcss` and update your PostCSS configuration.