当前位置: 首页 > news >正文

vue3使用tailwindcss报错问题

  1. npm create vite@latest
  2. npm install -D tailwindcss postcss autoprefixer
  3. npx tailwindcss init
    4. ·不过执行 npx tailwindcss init 的时候控制台就报错了
    PS E:\vite-demo> npx tailwindcss init
    npm ERR! cb.apply is not a function
    npm ERR! A complete log of this run can be found in:
    
    1. 那就手动创建 tailwind.config.js文件和postcss.config.js文件
    	// tailwind.config.js/** @type {import('tailwindcss').Config} */module.exports = {content: ["./src/**/*.{html,js}"],theme: {extend: {},},plugins: [],}
    // postcss.config.js
    module.exports = {plugins: {tailwindcss: {},autoprefixer: {},}
    }
    
    然后再style.css引入
    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    
    npm install
    报错
    [vite] Internal server error: [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.
    
  4. 重新安装 npm install @tailwindcss/postcss
	import postcssTailwind from '@tailwindcss/postcss'; import autoprefixer from 'autoprefixer'; export default { plugins: [ postcssTailwind, autoprefixer ]};

注意: 要看清版本 现在安装的tailwindcss 是4.x 官网是3.x
地址:https://tailwindcss.com/

http://www.xdnf.cn/news/379531.html

相关文章:

  • C.循环函数基础
  • 远程调试---在电脑上devtools调试运行在手机上的应用
  • PyTorch API 3 - mps、xpu、backends、导出
  • 6.秒杀优化
  • 更换内存条会影响电脑的IP地址吗?——全面解析
  • A2A大模型协议及Java示例
  • 以影像为笔,劳润智在世界舞台上书写艺术之路
  • 不同句子切割(文本分段 / chunking)工具或库 各自采用的策略和目标对比和分析
  • OLE(对象链接与嵌入)剪贴板内容插入到 CAD 图形中——CAD c# 二次开发
  • 非阻塞式IO-Java NIO
  • TCP Socket编程
  • 分布式锁原理
  • Linux 信号终篇(总结)
  • OpenAI API JSON 格式指南与json_repair错误修复
  • 深入理解卷积神经网络的输入层:数据的起点与预处理核心
  • [Pandas]数据处理
  • MySQL 从入门到精通(六):视图全面详解 —— 虚拟表的灵活运用
  • PyTorch量化感知训练技术:模型压缩与高精度边缘部署实践
  • TDengine 在智能制造中的核心价值
  • 工控新宠| 触想Z系列工控机C款发布,方寸机身,智控万千
  • OSPF综合实验实验报告
  • 深度学习篇---MediaPipe 及其人体姿态估计模型详解
  • 广东省省考备考(第七天5.10)—言语:片段阅读(每日一练)
  • Vue插槽(Slots)详解
  • SkyReels-V2 视频生成
  • Cadence 高速系统设计流程及工具使用三
  • 加速pip下载:永久解决网络慢问题
  • 数据集-目标检测系列- 冥想 检测数据集 close_eye>> DataBall
  • AI实战笔记(1)AI 的 6 大核心方向 + 学习阶段路径
  • Linxu实验五——NFS服务器