加载 PostCSS 插件失败:找不到模块“tailwindcss”

xsp*_*000 10 npm autoprefixer postcss tailwind-css vite

这是我的第一个 Tailwind CSS 项目,从 CDN 开始,但我并不总是有互联网,所以我尝试使用 PostCSS 安装它,并且我使用 Vite 作为我的服务器。

关注了 CodeWithHarry 的这段视频https://www.youtube.com/watch?v=aUunolbb1xU&list=PLu0W_9lII9ahwFDuExCpPFHAK829Wto2O&index=3

我首先启动了该项目

npm init -y
Run Code Online (Sandbox Code Playgroud)

并安装了所需的软件包

npm install -D tailwind postcss autoprefixer vite
Run Code Online (Sandbox Code Playgroud)

然后通过以下方式启动 Tailwind CSS

npx tailwindcss init -p
Run Code Online (Sandbox Code Playgroud)

我还在 input.css 文件中输入了 @tailwind 指令。

但是当我跑的时候:

npm start
Run Code Online (Sandbox Code Playgroud)

我的 vite 服务器向我打招呼时出现以下错误:

npm init -y
Run Code Online (Sandbox Code Playgroud)

错误截图

我的index.html:

npm install -D tailwind postcss autoprefixer vite
Run Code Online (Sandbox Code Playgroud)

我的 tailwind.config.js:

npx tailwindcss init -p
Run Code Online (Sandbox Code Playgroud)

我的 postcss.config.js:

npm start
Run Code Online (Sandbox Code Playgroud)

我的package.json:

[plugin:vite:css] Loading PostCSS Plugin failed: Cannot find module 'tailwindcss'
Require stack:
 - C:\projects\2 Shidhu\twproject\noop.js
 
 (@C:\projects\2 Shidhu\twproject\postcss.config.js)
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

JEd*_*dot 32

并安装了所需的软件包npm install -D tailwind postcss autoprefixer vite

包裹tailwindcss不是tailwind

npm install -D tailwindcss postcss autoprefixer vite
npm tailwindcss init
Run Code Online (Sandbox Code Playgroud)