解决 NuxtContent 与 better-sqlite3 绑定文件错误

2025-12-198 mins readfrontendvue

错误现象

安装 nuxt-content 模块并选择 better-sqlite3 , 启动开发服务器会报错

powershell

loading...

错误分析

这是因为 better-sqlite3nodejs 原生模块, 需要编译安装

错误处理

  1. 确保安装了 Visual Studio 里的 C++桌面开发 套件
  2. 删除 node_modules
  3. 清除一下 pnpm 存储 pnpm store prune
  4. 现在应该可以正常运行了

--- 评论区施工中🚧 ---

CC BY-NC-SA 4.0