TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.23k stars 817 forks source link

Unable to install sqlite3 #1748

Open laozl opened 10 months ago

laozl commented 10 months ago

Issue Summary

I am using the Win11 operating system and I want to integrate SQLITE3 into Electron, but it cannot be compiled and installed in node 18.18.2. Strangely, he will search for it link However, this address does not exist

Relevant logs or output

• electron-builder version=24.9.1 • loaded configuration file=H:\Code\WebstormProjects\electron-app\electron-builder.yml • rebuilding native dependencies dependencies=sqlite3@5.1.7 platform=win32 arch=x64 • install prebuilt binary name=sqlite3 version=5.1.7 platform=win32 arch=x64 napi= • build native dependency from sources name=sqlite3 version=5.1.7 platform=win32 arch=x64 napi= reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information) error=prebuild-install info begin Prebuild-install version 7.1.1 prebuild-install warn This package does not support N-API version 36 prebuild-install warn install prebuilt binaries enforced with --force! prebuild-install warn install prebuilt binaries may be out of date! prebuild-install info looking for local prebuild @ prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install info looking for cached prebuild @ C:\Users\Letudou\AppData\Roaming\npm-cache_prebuilds\9aa761-sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install http 404 https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz prebuild-install warn install No prebuilt binaries found (target=36 runtime=napi arch=x64 libc= platform=win32)

• rebuilding native dependency name=sqlite3 version=5.1.7 ⨯ cannot execute cause=exit status 1 $ prebuild-install -r napi || node-gyp rebuild info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

                errorOut=prebuild-install warn This package does not support N-API version 28.1.1
prebuild-install warn install No prebuilt binaries found (target=28.1.1 runtime=napi arch=x64 libc= platform=win32)
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@18.18.2 | win32 | x64
gyp info find Python using Python version 3.10.9 found at "D:\Python\Python310\python.exe"
gyp info find VS using VS2022 (17.8.34330.188) found at:
gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Professional"
gyp info find VS run with --verbose for detailed information
gyp info spawn D:\Python\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'H:\\Code\\WebstormProjects\\electron-app\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'H:\\Code\\WebstormProjects\\electron-app\\node_modules\\sqlite3\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'H:\\Code\\WebstormProjects\\electron-app\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Letudou\\.electron-gyp\\28.1.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Letudou\\.electron-gyp\\28.1.1',
gyp info spawn args   '-Dnode_gyp_dir=H:\\Code\\WebstormProjects\\electron-app\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Letudou\\\\.electron-gyp\\\\28.1.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=H:\\Code\\WebstormProjects\\electron-app\\node_modules\\sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'H:\\Code\\WebstormProjects\\electron-app\\node_modules\\sqlite3\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: Active code page: 65001
..\node-addon-api\node_api.gyp not found (cwd: H:\Code\WebstormProjects\electron-app\node_modules\sqlite3) while loading dependencies of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (H:\Code\WebstormProjects\electron-app\node_modules\node-gyp\lib\configure.js:259:16)
gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
gyp ERR! System Windows_NT 10.0.22631
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "H:\\Code\\WebstormProjects\\electron-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd H:\Code\WebstormProjects\electron-app\node_modules\sqlite3
gyp ERR! node -v v18.18.2
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok

error Command failed with exit code 1.

                command='C:\Program Files\nodejs\node.exe' 'D:\node\nvm\v18.18.2\node_modules\yarn\bin\yarn.js' run install
                workingDir=H:\Code\WebstormProjects\electron-app\node_modules\sqlite3

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Version

5.1.7

Node.js Version

18.18.2

How did you install the library?

yarn add sqlite3

laozl commented 10 months ago

But I'm going to modify the ` node_ In modules/sqlite3/package. json ',' binary ': {' napi_versions': [3,6]} 'is' binary': {'napi_versions': [6]}', which can be processed

xieerduos commented 10 months ago

I also encountered the same problem. Do you know how to solve it? thanks

qyn980427 commented 10 months ago

I also encountered the same problem. Do you know how to solve it? thanks

1746 I feel that the problem is the same as the problem I raised, and this solution proposed by this friend or manually downloaded to the local can be temporarily solved @laozl

xieerduos commented 10 months ago

I also encountered the same problem. Do you know how to solve it? thanks

1746 I feel that the problem is the same as the problem I raised, and this solution proposed by this friend or manually downloaded to the local can be temporarily solved @laozl

I've conducted tests and discovered that the issue began with version 5.1.7 of sqlite3. To temporarily resolve this, you can specify version 5.1.6 in your package.json file. Simply add or modify the sqlite3 dependency in the following manner:

"dependencies": {
    "sqlite3": "5.1.6"
}

This should bypass the issue until a permanent fix is implemented.

laozl commented 10 months ago

I also encountered the same problem. Do you know how to solve it? thanks

1746 I feel that the problem is the same as the problem I raised, and this solution proposed by this friend or manually downloaded to the local can be temporarily solved @laozl

I've conducted tests and discovered that the issue began with version 5.1.7 of sqlite3. To temporarily resolve this, you can specify version 5.1.6 in your package.json file. Simply add or modify the sqlite3 dependency in the following manner:

"dependencies": {
    "sqlite3": "5.1.6"
}

This should bypass the issue until a permanent fix is implemented.

Thank you very much. Your plan has solved the troubles that have troubled me for a few days at once

andyImatest commented 10 months ago

I'm having the same issue with v5.1.7:

prebuild-install info looking for local prebuild @ prebuilds\sqlite3-v5.1.7-napi-v36-win32-x64.tar.gz

which should be looking for sqlite3-v5.1.7-napi-v6-win32-x64.tar.gz

Will pin to version v5.1.6 for now, but would love to make use of the improved bundling!

milux commented 9 months ago

+1

faribauc commented 8 months ago

+1 with sqlite3 5.1.7

Confirmed it works when locking 5.1.6

webdevepru commented 7 months ago

it doesn't work for me since "sqlite3": "5.1.6", "electron": "^28.2.1", "electron-builder": "^24.13.3",

jesusrogliero commented 6 months ago
"sqlite3": "5.1.6"

It worked for me, thank you very much. Funciono para mi, Muchas gracias

"devDependencies": {
    "electron": "^13.4.0",
    "electron-builder": "^22.13.1",
    "eslint": "^7.32.0",
    "eslint-plugin-react": "^7.26.0"
},
"dependencies": {
    "@navpreetdevpuri/html-pdf": "^3.0.9",
    "appdata-path": "^1.0.0",
    "bcrypt": "5.1.0",
    "bcv-divisas": "^1.2.6",
    "electron-log": "^4.4.1",
    "electron-updater": "^6.1.1",
    "googleapis": "^123.0.0",
    "handlebars": "^4.7.8",
    "moment": "^2.29.4",
    "nodemailer": "^6.9.3",
    "sequelize": "^6.6.5",
    "sqlite3": "5.1.6"
}
pranavwani commented 6 months ago

This worked:

export LDFLAGS="-L`brew --prefix`/opt/sqlcipher/lib"
export CPPFLAGS="-I`brew --prefix`/opt/sqlcipher/include/sqlcipher"
npm install sqlite3@5.1.6 --build-from-source --sqlite_libname=sqlcipher --sqlite=`brew --prefix` --runtime=electron --target=27.3.9 --dist-url=https://electronjs.org/headers

node -e 'require("sqlite3")'

Thanks @xieerduos

Sailwayfun commented 3 weeks ago

Is this issue resolved? I'm on

electron: "^7.0.0" electron-builder: "^22.11.7"

After I downgraded sqlite3 to 5.1.6, when I build the app, it got stuck at packaging stage

HatunaPatata commented 1 week ago

electron: "^7.0.0"

@Sailwayfun why are you using such an old version of electron? It's currently on version 33.

Sailwayfun commented 1 week ago

electron: "^7.0.0"

@Sailwayfun why are you using such an old version of electron? It's currently on version 33.

I'm on several legacy desktop electron projects, and our team has no intention of QAing an up-to-date version. Anyways I finally downgraded sqlite3 to 5.0.0 and it worked fine.