I am trying to build sql-language-server using the instructions found here concerning the nixpkgs/pkgs/development/node-packages/generate.sh
script. I get errors like:
npm ERR! find: ‘/usr/bin’: No such file or directory
npm ERR! find: ‘/usr/local/bin’: No such file or directory
npm ERR! find: ‘/usr/pg*’: No such file or directory
npm ERR! find: ‘/opt’: No such file or directory
I have been trying to figure out how other packages handle this by looking at the nixpkgs/pkgs/development/node-packages/overrides.nix
file. So far, I can’t figure out the incantation that will convince this package to build correctly. What am I missing?
It is possible this issue is specific to the package you are trying to add, or specific to one of it’s dependencies. Does npm tell you which package / dependency it is that through these errors? Why do you think this is related to node-gyp
?
It seems the issue is related to the libpq
dependency in node_modules
. I think node-gyp
is involved because of the gyp ERR!
output here:
Adding metadata fields to: node_modules/yn/package.json
npm WARN config production Use `--omit=dev` instead.
npm ERR! code 1
npm ERR! path /nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/libpq
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@18.16.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.11 found at "/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/bin/python3"
npm ERR! gyp WARN read config.gypi ENOENT: no such file or directory, open '/nix/store/shaf8b6rn3v0mjnd26lfkklihn1vznly-node-sources/include/node/config.gypi'
npm ERR! gyp info spawn /nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/libpq/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/nix/store/shaf8b6rn3v0mjnd26lfkklihn1vznly-node-sources/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/nix/store/shaf8b6rn3v0mjnd26lfkklihn1vznly-node-sources',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/nix/store/shaf8b6rn3v0mjnd26lfkklihn1vznly-node-sources/$(Configuration)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/libpq',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /nix/store/rhvbjmcfnkg8i2dxpzr114cp1ws7f667-bash-5.2-p15/bin/sh: line 1: which: command not found
npm ERR! find: ‘/usr/bin’: No such file or directory
npm ERR! find: ‘/usr/local/bin’: No such file or directory
npm ERR! find: ‘/usr/pg*’: No such file or directory
npm ERR! find: ‘/opt’: No such file or directory
npm ERR! gyp: Call to 'which pg_config || find /usr/bin /usr/local/bin /usr/pg* /opt -executable -name pg_config -print -quit' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/node-gyp/lib/configure.js:259:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 6.2.11
npm ERR! gyp ERR! command "/nix/store/6aphgr19pzc8v416zaf6vbs7r9jsbajp-nodejs-18.16.0/bin/node" "/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/libpq
npm ERR! gyp ERR! node -v v18.16.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /build/.npm/_logs/2023-05-25T11_40_10_911Z-debug-0.log
error: builder for '/nix/store/5czysjmvgdhywl1yga7vhi9apnw98pac-sql-language-server-1.5.1.drv' failed with exit code 1;
last 10 log lines:
> npm ERR! gyp ERR! System Linux 6.2.11
> npm ERR! gyp ERR! command "/nix/store/6aphgr19pzc8v416zaf6vbs7r9jsbajp-nodejs-18.16.0/bin/node" "/nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/.bin/node-gyp" "rebuild"
> npm ERR! gyp ERR! cwd /nix/store/w5n33iz1zh0s8n6i482d2m4n9q86k1y2-sql-language-server-1.5.1/lib/node_modules/sql-language-server/node_modules/libpq
> npm ERR! gyp ERR! node -v v18.16.0
> npm ERR! gyp ERR! node-gyp -v v8.4.1
> npm ERR! gyp ERR! not ok
>
> npm ERR! A complete log of this run can be found in:
> npm ERR! /build/.npm/_logs/2023-05-25T11_40_10_911Z-debug-0.log
>
I think this is the issue:
{
'conditions': [
['OS=="linux"', {
'variables' : {
# Find the pull path to the pg_config command, since iy may not be on the PATH
'pgconfig': '<!(which pg_config || find /usr/bin /usr/local/bin /usr/pg* /opt -executable -name pg_config -print -quit)'
}
}, {
#Default to assuming pg_config is on the PATH.
'variables': {
'pgconfig': 'pg_config'
},
}]
],
'targets': [
{
You can try and add postgresql
to the buildInputs
via node-packages/overrides.nix