0
> [email protected] install /home/johnsoct/bobtail/node_modules/libpq
> node-gyp rebuild

/home/johnsoct/.nvm/versions/node/v12.22.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: line 5: /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js: No such file or directory

I have read the error, and no, there isn't anything installed at /usr/local/lib/... When I install node-gyp globally, it doesn't install there.

I've tried:

  • reinstalling postgres (https://fedoraproject.org/wiki/PostgreSQL)
  • installing libpq for fedora
  • restarting 512394823094 times
  • removing node_modules and reinstalling (over and over just hoping something magical happens)
  • removing package-lock.json and re-installing
  • some other stuff I've long forgotten

One little hint I'm aware of: the package that ISN'T getting installed on npm install is pg-native. Not sure that makes a difference, but figure it's related since libpq is being mentioned in the install report.

If you're curious, this is what my PATH looks like (I installed and uninstalled postgres using linuxbrew originally): /home/johnsoct/bin:/usr/pgsql-10/bin:/usr/pgsql-10/bin:/home/linuxbrew/.linuxbrew/opt/postgresql@10/bin:/home/johnsoct/bin:/home/linuxbrew/.linuxbrew/opt/postgresql@10/bin:/home/johnsoct/.nvm/versions/node/v12.22.4/bin:/home/johnsoct/.local/bin:/home/johnsoct/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin

Any advice/suggestions would be really helpful... Losing my mind here.

1 Answer 1

1

This is very far fetched, but since I had the same issues building just libpq using node-gyp I thought I'd share my fix anyways, just in case.

My error output looked like this:

$ npm install
npm ERR! code 1
npm ERR! path /home/ekik/Source/home/grafana/node_modules/libpq
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! node:internal/modules/cjs/loader:936
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module 'object-assign'
npm ERR! Require stack:

It started happening when I upgraded from NodeJS 14 to 16 or 18 on Manjaro Linux. Apparently the node-gyp package that's being shipped is using tons of deprecated stuff (gathered from the npm install logs), that apparently isn't installed by default (anymore).

My very dirty fix was simply:

sudo npm install --global object-assign code-point-at number-is-nan request

Please be aware that this pollutes your global node_modules.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .