From 07a4f7784ff1e0bfcbb58456306a91a53d287399 Mon Sep 17 00:00:00 2001 From: Yue_plus Date: Wed, 14 May 2025 16:37:42 +0800 Subject: [PATCH 1/2] Update README.md Remind users that they don't have to install `node-gyp` and can directly use the releases files. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2c753185..b6a7c7a3 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,14 @@ npm install better-sqlite3 > Requires Node.js v14.21.1 or later. Prebuilt binaries are available for [LTS versions](https://nodejs.org/en/about/releases/). If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md). +### If you don't want to setup `node-gyp` ... + +``` +npm install better-sqlite3 --ignore-scripts +``` + +Then go to the [Releases](https://github.com/WiseLibs/better-sqlite3/releases/) page to download the corresponding version and place the file at `node_modules/better-sqlite3/build/Release/better_sqlite3.node` + ## Usage ```js From 3d7530d9fb7a16aa2a21b2872d86fd8a72bb64b6 Mon Sep 17 00:00:00 2001 From: Yue-plus Date: Thu, 15 May 2025 09:44:47 +0800 Subject: [PATCH 2/2] docs: update troubleshooting instructions for node-gyp errors --- README.md | 8 -------- docs/troubleshooting.md | 13 +++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b6a7c7a3..2c753185 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,6 @@ npm install better-sqlite3 > Requires Node.js v14.21.1 or later. Prebuilt binaries are available for [LTS versions](https://nodejs.org/en/about/releases/). If you have trouble installing, check the [troubleshooting guide](./docs/troubleshooting.md). -### If you don't want to setup `node-gyp` ... - -``` -npm install better-sqlite3 --ignore-scripts -``` - -Then go to the [Releases](https://github.com/WiseLibs/better-sqlite3/releases/) page to download the corresponding version and place the file at `node_modules/better-sqlite3/build/Release/better_sqlite3.node` - ## Usage ```js diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 1197f34d..001fdcf7 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -10,6 +10,19 @@ If `better-sqlite3` refuses to install, follow these guidelines: - Make sure you're using a [supported version of Node.js](https://nodejs.org/en/about/previous-releases). `better-sqlite3` is only tested with currently-supported versions of Node.js. +## Encountering a `node-gyp` error report + +This error may occur when the pre-built file cannot be obtained properly. +To bypass the post-installation script, run the following command first: + +``` +npm install better-sqlite3 --ignore-scripts +``` + +Then, navigate to the [Releases](https://github.com/WiseLibs/better-sqlite3/releases/) page to download the corresponding version. +After downloading, place the file in the following location: +`node_modules/better-sqlite3/build/Release/better_sqlite3.node` + ## "Install the necessary tools" - If you're on Windows, during installation of Node.js, be sure to select "Automatically install the necessary tools" from the "Tools for Native Modules" page.