If you have trouble installing better-sqlite3
, follow this checklist:
- Make sure you're using Node.js v14.21.1 or later.
- If you're on Windows, while installing, be sure to select "Automatically install the necessary tools" on the "Tools for Native Modules" page, and follow the remaining steps, including opening an admin PowerShell and installing visual studio and python. Everything should just work.
- Make sure you have
node-gyp
globally installed - Make sure all
node-gyp
dependencies are installed. On Windows you may need to configure some things manually. Usenpm ls node-gyp
to make sure none of your local packages installed an outdated version ofnode-gyp
that is used over the global one.
- Make sure there are no spaces in your project path:
node-gyp
may not escape spaces or special characters (like%
or$
) properly.
- If you're using Electron, try running
electron-rebuild
If you still have issues on Windows and are on an older version of Node, try these steps:
- Install the latest of node 14, 16, or 18.
- Install latest Visual Studio Community and Desktop Development with C++ extension.
- Install latest Python.
- Run following commands:
npm config set msvs_version 2019
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
- Delete your
node_modules
subdirectory - Delete your
$HOME/.node-gyp
directory - Run
npm install
If none of these solved your problem, try browsing previous issues or open a new issue.