如何解决NuxtContent的better-sqlite3报错
2025-12-1910 mins readfrontendvue
错误现象
安装 nuxt-content 模块并选择 better-sqlite3 , 启动开发服务器会报错
powershell
loading...
错误分析
这是因为 better-sqlite3 是 nodejs 原生模块, 需要编译安装
错误处理
- 确保安装了
Visual Studio里的C++桌面开发套件 - 在
devDependencies中添加better-sqlite3 - 在
onlyBuiltDependencies中添加better-sqlite3
package.json
loading...
- 删除
node_modules - 清除一下
pnpm存储pnpm store prune - 现在应该可以正常运行了
--- 评论区施工中🚧 ---