L
L
linqu2016-09-22 09:23:56
Node.js
linqu, 2016-09-22 09:23:56

Nodejs npm: how to overcome error when trying to install pg-native module?

I'm trying to install the pg-native module, it gives an error:

# npm i pg-native

> [email protected] install /var/www/v/node_modules/libpq
> node-gyp rebuild

You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
gyp: Call to '/usr/bin/pg_config --libdir' 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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command "/usr/bin/nodejs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/v/node_modules/libpq
gyp ERR! node -v v6.6.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
/var/www/v
├── [email protected]
├── [email protected]
└── [email protected]

npm WARN enoent ENOENT: no such file or directory, open '/var/www/v/package.json'
npm WARN v No description
npm WARN v No repository field.
npm WARN v No README data
npm WARN v No license field.
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "i" "pg-native"
npm ERR! node v6.6.0
npm ERR! npm  v3.9.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the libpq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs libpq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls libpq
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/v/npm-debug.log

What can be wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
linqu, 2016-09-22
@linqu

Understood, just read carefully:

You need to install postgresql-server-dev-XY for building a server-side extension or libpq-dev for building a client-side application.

A
alexmost113, 2017-04-05
@alexmost113

sudo apt-get install libpq-dev

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question