Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Issues with node-libpq #393

Open
ehmicky opened this issue Apr 14, 2020 · 2 comments
Open

Issues with node-libpq #393

ehmicky opened this issue Apr 14, 2020 · 2 comments
Labels
type: bug code to address defects in shipped code

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Apr 14, 2020

A user reported the following build error:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 2.7.12 found at "/opt/buildhome/python2.7/bin/python"
gyp http GET https://nodejs.org/download/release/v10.20.1/node-v10.20.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.20.1/node-v10.20.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.20.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.20.1/SHASUMS256.txt
gyp info spawn /opt/buildhome/python2.7/bin/python
gyp info spawn args [ '/opt/buildhome/.nvm/versions/node/v10.20.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/opt/build/repo/node_modules/libpq/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/opt/buildhome/.nvm/versions/node/v10.20.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/opt/buildhome/.cache/node-gyp/10.20.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=/opt/buildhome/.cache/node-gyp/10.20.1',
gyp info spawn args '-Dnode_gyp_dir=/opt/buildhome/.nvm/versions/node/v10.20.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/opt/buildhome/.cache/node-gyp/10.20.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/opt/build/repo/node_modules/libpq',
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 'build',
gyp info spawn args '-Goutput_dir=.' ]
find: ‘/usr/pg*’: No such file or directory
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
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/opt/buildhome/.nvm/versions/node/v10.20.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.14.138+
gyp ERR! command "/opt/buildhome/.nvm/versions/node/v10.20.1/bin/node" "/opt/buildhome/.nvm/versions/node/v10.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/build/repo/node_modules/libpq
gyp ERR! node -v v10.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error during Yarn install
Error running command: Build script returned non-zero exit code: 1

This happens when using node-libpq. That library does not mention requiring it but other users are reporting this problem.

Checking their binding.gyp, the problem is that they are looking for Postgres executable in /usr/bin, /usr/local/bin, /opt or /usr/pg*. However if /usr/pg* does not exist, it errors. I am not sure if this is a bug in their binding.gyp or whether that library expects postgresql-dev to be installed.

@ehmicky ehmicky changed the title Add apt-get install postgresql-dev [WIP] Add apt-get install postgresql-dev Apr 14, 2020
@ehmicky ehmicky added the type: bug code to address defects in shipped code label Apr 14, 2020
@ehmicky ehmicky changed the title [WIP] Add apt-get install postgresql-dev This does not work with node-libpq Apr 14, 2020
@ehmicky ehmicky changed the title This does not work with node-libpq Issues with node-libpq Apr 14, 2020
@mraerino
Copy link
Contributor

mraerino commented May 4, 2020

with #411 this could be installed via a Brewfile: https://formulae.brew.sh/formula-linux/libpq

FinnWoelm added a commit to FinnWoelm/broken-sequelize-netlify that referenced this issue Aug 22, 2020
This reverts commit b157885.

Installing pg-native fails on netlify due to node-libpq.

Seems to be a known issue:
- https://community.netlify.com/t/unable-to-publish-function-using-postgres/12293/3
- netlify/build-image#393
@borispov
Copy link

Installing libpq via Brewfile didn't solve the problem for me as it required libpq to exist inside node_modules.

I ended up using this postgres postgres driver that has 0 dependencies and builds on netlify without issues (so far).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

3 participants