brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
112 stars 42 forks source link

npm install error on ElasticBeanstalk box #24

Closed emertechie closed 9 years ago

emertechie commented 9 years ago

I'm trying to deploy an app which uses this library onto an ElasticBeanstalk box and I get the following error:

npm info install libpq@1.6.4

> libpq@1.6.4 install /home/ec2-user/deleteme/node_modules/libpq
> node-gyp rebuild

/opt/elasticbeanstalk/node-install/node-v0.12.6-linux-x64/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: line 3: node: command not found
npm verb unsafe-perm in lifecycle true
npm info libpq@1.6.4 Failed to exec install script
npm verb unlock done using /home/ec2-user/.npm/_locks/libpq-fcbd9186c457f208.lock for /home/ec2-user/deleteme/node_modules/libpq
npm verb stack Error: libpq@1.6.4 install: `node-gyp rebuild`
npm verb stack spawn ENOENT
npm verb stack     at ChildProcess.<anonymous> (/opt/elasticbeanstalk/node-install/node-v0.12.6-linux-x64/lib/node_modules/npm/lib/utils/spawn.js:17:16)
npm verb stack     at ChildProcess.emit (events.js:110:17)
npm verb stack     at maybeClose (child_process.js:1015:16)
npm verb stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
npm verb pkgid libpq@1.6.4
npm verb cwd /home/ec2-user/deleteme
npm ERR! Linux 3.14.42-31.38.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v0.12.6-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.12.6-linux-x64/bin/npm" "--verbose" "install" "libpq"
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! libpq@1.6.4 install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the libpq@1.6.4 install script 'node-gyp rebuild'.
npm ERR! 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 their info via:
npm ERR!     npm owner ls libpq
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]
npm verb unbuild node_modules/libpq
npm info preuninstall libpq@1.6.4
npm info uninstall libpq@1.6.4
npm verb unbuild rmStuff libpq@1.6.4 from /home/ec2-user/deleteme/node_modules
npm info postuninstall libpq@1.6.4
npm verb gentlyRm don't care about contents; nuking /home/ec2-user/deleteme/node_modules/libpq

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ec2-user/deleteme/npm-debug.log

ElasticBeanstalk box is running node 0.12.6. I configured EB to install the postgresql93-devel package via yum so I now have pg_config in the path. Is there anything that needs to be in the path?

I'm at a bit of a loss for what else could be wrong. Appreciate any suggestions

Thanks

emertechie commented 9 years ago

My bad - I was running the npm install command via ssh session for quick testing. After adding in the postgresql93-devel package to ElasticBeanstalk config, a full redeploy now works.

For anyone else who stumbles on this, the EB config you need is just:

packages:
  yum:
    postgresql93-devel: []

in a .config file in the .ebextensions folder