查看错误日志
控制台错误提示
npm ERR! A complete log of this run can be found in: /Users/edy/.npm/_logs/2025-02-17T02_54_29_909Z-debug-0.log
查看错误日志详情
cat /Users/edy/.npm/_logs/2025-02-17T02_54_29_909Z-debug-0.log
错误原因与解决方案
因为 Tailwind V4不支持init命令,可以安装V3,Installing Tailwind CSS with Vite - Tailwind CSS
V3可以执行init指令。
$ npm install -D tailwindcss@3 postcss autoprefixer
$ npx tailwindcss init
npx tailwindcss init -p和npx tailwindcss init的区别
如果项目已有 PostCSS 配置,使用 npx tailwindcss init
如果项目需要从头配置 PostCSS,使用 npx tailwindcss init -p
总结
安装TailwindV3解决V4没有init指令的问题
$ npm install -D tailwindcss@3 postcss autoprefixer
$ npx tailwindcss init -p