You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't know about this patch and have multiple times encountered the issue of node-gyp complaining that it doesn't have the setuptools python dependency. This was expected, since I was just using python3 (or nodejs.python).
What really surprised me was that this didn't happen before with buildNpmPackage, only with the newer yarnConfgHook and pnpm.configHook
So, like mentioned before, NIX_NODEJS_BUILDNPMPACKAGE needs to be set to trigger the special node-gyp resolution logic, but it's not being set by the other config-hooks.
You can get most of the packages that had to manually specify setuptools with this command: rg nodejs -l | xargs rg setuptools
Steps to reproduce
Build gancio, but replace python.withPackages ... with just python.
It will fail because of node-gyp.
Now set env.NIX_NODEJS_BUILDNPMPACKAGE = "1"
It will work again.
Expected behaviour
I don't know what should be done. I'm looking for ideas. Maybe other hooks should also include this env var?
Screenshots
No response
Relevant log output
\npm verbose pkgid [email protected]\npm error code 1\npm error path /build/source/node_modules/sqlite3\npm error command failed\npm error command sh -c prebuild-install -r napi || node-gyp rebuild\npm error prebuild-install info begin Prebuild-install version 7.1.2npm error prebuild-install warn This package does not support N-API version undefinednpm error prebuild-install info looking for local prebuild @ prebuilds/sqlite3-v5.1.7-napi-v127-linux-x64.tar.gznpm error prebuild-install info looking for cached prebuild @ /build/tmp.hZhD0p5K9r/.npm/_prebuilds/fb8c35-sqlite3-v5.1.7-napi-v127-linux-x64.tar.gznpm error prebuild-install http request GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v127-linux-x64.tar.gznpm error prebuild-install warn install getaddrinfo EAI_AGAIN github.comnpm error gyp info it worked if it ends with oknpm error gyp verb cli [npm error gyp verb cli '/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0/bin/node',npm error gyp verb cli '/build/source/node_modules/sqlite3/node_modules/.bin/node-gyp',npm error gyp verb cli 'rebuild'npm error gyp verb cli ]npm error gyp info using [email protected]npm error gyp info using [email protected] | linux | x64npm error gyp verb command rebuild []npm error gyp verb command clean []npm error gyp verb clean removing "build" directorynpm error gyp verb command configure []npm error gyp verb find Python Python is not set from command line or npm configurationnpm error gyp verb find Python Python is not set from environment variable PYTHONnpm error gyp verb find Python checking if "python3" can be usednpm error gyp verb find Python - executing "python3" to get executable pathnpm error (node:708) [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 verb find Python - executable path is "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/bin/python3"npm error gyp verb find Python - executing "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/bin/python3" to get versionnpm error gyp verb find Python - version is "3.12.9"npm error gyp info find Python using Python version 3.12.9 found at "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/bin/python3"npm error gyp verb get node dir compiling against specified --nodedir dev files: /nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0npm error gyp verb build dir attempting to create "build" dir: /build/source/node_modules/sqlite3/buildnpm error gyp verb build dir "build" dir needed to be created? Yesnpm error gyp verb build/config.gypi creating config filenpm error gyp verb build/config.gypi writing out config file: /build/source/node_modules/sqlite3/build/config.gypinpm error gyp verb config.gypi checking for gypi file: /build/source/node_modules/sqlite3/config.gypinpm error gyp verb common.gypi checking for gypi file: /build/source/node_modules/sqlite3/common.gypinpm error gyp verb gyp gyp format was not specified; forcing "make"npm error gyp info spawn /nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/bin/python3npm error gyp info spawn args [npm error gyp info spawn args '/build/source/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 '/build/source/node_modules/sqlite3/build/config.gypi',npm error gyp info spawn args '-I',npm error gyp info spawn args '/build/source/node_modules/node-gyp/addon.gypi',npm error gyp info spawn args '-I',npm error gyp info spawn args '/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.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=/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0',npm error gyp info spawn args '-Dnode_gyp_dir=/build/source/node_modules/node-gyp',npm error gyp info spawn args '-Dnode_lib_file=/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0/$(Configuration)/node.lib',npm error gyp info spawn args '-Dmodule_root_dir=/build/source/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 "/build/source/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>npm error import gyp # noqa: E402npm error ^^^^^^^^^^npm error File "/build/source/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>npm error import gyp.inputnpm error File "/build/source/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>npm error from distutils.version import StrictVersionnpm error ModuleNotFoundError: No module named 'distutils'npm error gyp ERR! configure errornpm error gyp ERR! stack Error: `gyp` failed with exit code: 1npm error gyp ERR! stack at ChildProcess.onCpExit (/build/source/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 Linux 6.12.11npm error gyp ERR! command "/nix/store/7l1wra7b87yci5dln0hm0k8rwww6f2xj-nodejs-22.14.0/bin/node" "/build/source/node_modules/sqlite3/node_modules/.bin/node-gyp" "rebuild"npm error gyp ERR! cwd /build/source/node_modules/sqlite3npm error gyp ERR! node -v v22.14.0npm error gyp ERR! node-gyp -v v8.4.1npm error gyp ERR! not ok
Additional context
No response
System metadata
system: "x86_64-linux"
host os: Linux 6.12.11, NixOS, 25.05 (Warbler), 25.05.20250127.f898cbf
Nixpkgs version
25.05 (unstable)
Describe the bug
There is a patch used in
nodejs
which adds special functionality if theNIX_NODEJS_BUILDNPMPACKAGE
env var is set.See:
https://github.com/NixOS/nixpkgs/blob/b56714751a891d9b56f26550fa515bddacf7feff/pkgs/development/web/nodejs/node-npm-build-npm-package-logic.patch
This is only ever being used in
npmConfigHook
.See:
nixpkgs/pkgs/build-support/node/build-npm-package/hooks/npm-config-hook.sh
Line 7 in 3dbd57d
I didn't know about this patch and have multiple times encountered the issue of
node-gyp
complaining that it doesn't have thesetuptools
python dependency. This was expected, since I was just usingpython3
(ornodejs.python
).What really surprised me was that this didn't happen before with
buildNpmPackage
, only with the neweryarnConfgHook
andpnpm.configHook
So, like mentioned before,
NIX_NODEJS_BUILDNPMPACKAGE
needs to be set to trigger the specialnode-gyp
resolution logic, but it's not being set by the other config-hooks.You can get most of the packages that had to manually specify
setuptools
with this command:rg nodejs -l | xargs rg setuptools
Steps to reproduce
Build
gancio
, but replacepython.withPackages ...
with justpython
.It will fail because of
node-gyp
.Now set
env.NIX_NODEJS_BUILDNPMPACKAGE = "1"
It will work again.
Expected behaviour
I don't know what should be done. I'm looking for ideas. Maybe other hooks should also include this env var?
Screenshots
No response
Relevant log output
Additional context
No response
System metadata
"x86_64-linux"
Linux 6.12.11, NixOS, 25.05 (Warbler), 25.05.20250127.f898cbf
yes
yes
nix-env (Nix) 2.24.11
/nix/store/8711q2ng7k38b816qw6i3bp4bsl57r70-source
Notify maintainers
@winterqt
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE
.)I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: