Skip to content

npm install sqlite3 fail if prebuilt unreachable and Python v3.12 is installed #1752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yfdyh000 opened this issue Jan 19, 2024 · 4 comments

Comments

@yfdyh000
Copy link

Issue Summary

Retrieval of pre-built files failed due to my network issue.
Then, the build step fails due to Python and node-gyp version incompatibility.

nodejs/node-gyp#2869
nodejs/node-gyp#2942 (comment)

Relevant logs or output

691 verbose pkgid [email protected]

693 verbose Windows_NT 10.0.19045
694 verbose node v18.17.0
695 verbose npm v10.2.5

prebuild-install warn install connect ETIMEDOUT 20.205.243.166:443

700 error gyp info spawn args ]
700 error Traceback (most recent call last):
700 error File "[dir]\node_modules\node-gyp\gyp\gyp_main.py", line 42, in
700 error import gyp # noqa: E402
700 error ^^^^^^^^^^
700 error File "[dir]\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 9, in
700 error import gyp.input
700 error File "[dir]\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in
700 error from distutils.version import StrictVersion
700 error ModuleNotFoundError: No module named 'distutils'
700 error gyp ERR! configure error
700 error gyp ERR! stack Error: gyp failed with exit code: 1
700 error gyp ERR! stack at ChildProcess.onCpExit ([dir]\node_modules\node-gyp\lib\configure.js:259:16)
700 error gyp ERR! stack at ChildProcess.emit (node:events:514:28)
700 error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
700 error gyp ERR! System Windows_NT 10.0.19045
700 error gyp ERR! command "C:\Program Files\nodejs\node.exe" "[dir]\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
700 error gyp ERR! cwd [dir]\node_modules\sqlite3
700 error gyp ERR! node -v v18.17.0
700 error gyp ERR! node-gyp -v v8.4.1
700 error gyp ERR! not ok
701 verbose exit 1

Version

5.1.7

Node.js Version

18.17.0

How did you install the library?

Windows 10 x64

@segevfiner
Copy link

Need to bump prebuild-install AFAIK.

@Rob3rtS
Copy link

Rob3rtS commented May 3, 2024

I hit the same issue: my network situation does not allow downloading the prebuilt binary, and I need to upgrade to Python 3.12 due to security reasons.
There is even a (imho non-straight-forward) way to update npm's internal node-gyp version to 10.x: https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md

But the peerDependencies (https://github.com/TryGhost/node-sqlite3/blame/master/package.json#L58) and optionalDependencies (https://github.com/TryGhost/node-sqlite3/blame/master/package.json#L66) seem to prevent using a higher major version of node-gyp.

Would it work with "node-gyp": "^8.0.0" (to allow for higher major version as well?

@williamhaw
Copy link

Published my own package which resolves the error happening during npm install: https://www.npmjs.com/package/@williamhaw/sqlite3-bump-node-gyp

Published from branch: https://github.com/williamhaw/node-sqlite3/tree/fix/bump-node-gyp (thanks @branchvincent)

@eyalroth
Copy link

Latest sqlite3 fails to install on newest node (22.15.0) on MacOS 15.13.1 that comes with Python 3.12.

npm error code 1
npm error path /Users/user/repo/node_modules/sqlite3
npm error command failed
npm error command sh -c prebuild-install -r napi || node-gyp rebuild
npm error prebuild-install warn This package does not support N-API version undefined
npm error prebuild-install warn install No prebuilt binaries found (target=undefined runtime=napi arch=arm64 libc= platform=darwin)
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | darwin | arm64
npm error (node:79589) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.12.4 found at "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3"
npm error gyp info spawn /Library/Frameworks/Python.framework/Versions/3.12/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args   '/Users/user/repo/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args   'binding.gyp',
npm error gyp info spawn args   '-f',
npm error gyp info spawn args   'make',
npm error gyp info spawn args   '-I',
npm error gyp info spawn args   '/Users/user/repo/node_modules/sqlite3/build/config.gypi',
npm error gyp info spawn args   '-I',
npm error gyp info spawn args   '/Users/user/repo/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args   '-I',
npm error gyp info spawn args   '/Users/user/Library/Caches/node-gyp/22.15.0/include/node/common.gypi',
npm error gyp info spawn args   '-Dlibrary=shared_library',
npm error gyp info spawn args   '-Dvisibility=default',
npm error gyp info spawn args   '-Dnode_root_dir=/Users/user/Library/Caches/node-gyp/22.15.0',
npm error gyp info spawn args   '-Dnode_gyp_dir=/Users/user/repo/node_modules/node-gyp',
npm error gyp info spawn args   '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/22.15.0/<(target_arch)/node.lib',
npm error gyp info spawn args   '-Dmodule_root_dir=/Users/user/repo/node_modules/sqlite3',
npm error gyp info spawn args   '-Dnode_engine=v8',
npm error gyp info spawn args   '--depth=.',
npm error gyp info spawn args   '--no-parallel',
npm error gyp info spawn args   '--generator-output',
npm error gyp info spawn args   'build',
npm error gyp info spawn args   '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error Traceback (most recent call last):
npm error   File "/Users/user/repo/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
npm error     import gyp  # noqa: E402
npm error     ^^^^^^^^^^
npm error   File "/Users/user/repo/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
npm error     import gyp.input
npm error   File "/Users/user/repo/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
npm error     from distutils.version import StrictVersion
npm error ModuleNotFoundError: No module named 'distutils'
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
npm error gyp ERR! stack     at ChildProcess.onCpExit (/Users/user/repo/node_modules/node-gyp/lib/configure.js:259:16)
npm error gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
npm error gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm error gyp ERR! System Darwin 24.3.0
npm error gyp ERR! command "/Users/user/.nvm/versions/node/v22.15.0/bin/node" "/Users/user/repo/node_modules/.bin/node-gyp" "rebuild"
npm error gyp ERR! cwd /Users/user/repo/node_modules/sqlite3
npm error gyp ERR! node -v v22.15.0
npm error gyp ERR! node-gyp -v v8.4.1
npm error gyp ERR! not ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants