mardi 21 avril 2015

Node.js app won't deploy on AWS Elastic BeanStalk possibly due to missing PostgreSQL install

We have the following package.json file:

{
  "name" : "DecisionsConsole",
  "version" : "0.0.0",
  "private" : true,
  "scripts" : {
    "start" : "node app.js"
  },
  "dependencies" : {
    "express" : "4.0.0",
    "cookie-parser" : "1.1.0",
    "serve-favicon" : "2.0.0",
    "morgan" : "1.1.1",
    "body-parser" : "1.3.0",
    "express-session" : "1.2.1",
    "errorhandler" : "1.0.1",
    "ejs" : "1.0.0",
    "request" : "2.34.0",
    "async" : "0.4.0",
    "lodash" : "2.4.1",
    "socket.io" : "1.0.4",
    "moment" : "~2.5.1",
    "pg" : "2.11.1",
    "connect" : "2.14.3",
    "sql" : "0.37.0",
    "request-json" : "0.4.10",
    "simplesets" : "1.2.0",
    "grunt" : "0.4.4",
    "aws-sdk" : "2.0.0-rc.19",
    "webworker-threads" : "0.4.13",
    "indexof" : "*",
    "serve-index" : "1.6.1",
    "node-rest-client" : "0.8.0",
    "querystring" : "0.2.0",
    "xml2js" : "0.4.6",
    "msexcel-builder" : "0.0.2",
    "mime" : "1.3.4"
  },
  "devDependencies" : {
    "grunt-contrib-compress" : "~0.7.0",
    "grunt-contrib-compass" : "~0.7.2",
    "grunt-contrib-uglify" : "*",
    "nodeunit" : "*"
  }
}

We are using AWS Elastic BeanStalk environment based on 64bit Amazon Linux 2014.02 v1.0.1 running Node.js . The reason it is an older environment, and not one of the latest versions is because there appear to be conflicts with between some of our packages and the newer AWS environment.

While deploying we get an error Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.

Upon further investigation, we find errors like this in the eb-tools.log :

 /bin/sh: pg_config: command not found gyp: Call to 'pg_config --libdir' returned 
 exit status 127. gyp ERR! configure error gyp ERR! stack Error: `gyp` failed with 
 exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/opt/elasticbeanstalk/node-
 install/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/
 configure.js:337:16) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:
 98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:
 797:12) gyp ERR! System Linux 3.4.73-64.112.amzn1.x86_64 gyp ERR! command "node" "/
 opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/lib/node_modules/npm/
 node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /tmp/deployment/
 application/node_modules/pg gyp ERR! node -v v0.10.26 gyp ERR! node-gyp -v v0.12.2 
 gyp ERR! not ok > webworker-threads@0.4.13 install /tmp/deployment/application/
 node_modules/webworker-threads > node-gyp rebuild make: Entering directory `/tmp/
 deployment/application/node_modules/webworker-threads/build' CXX(target) Release/
 obj.target/WebWorkerThreads/src/WebWorkerThreads.o 

I realize it is a bit difficult to read, but it is all on one line in the eb-tools.log file. Upon some digging, I found this: Error installing node-gyp on ubuntu . However, i don't think it is related.

Upon further research, I found this: http://ift.tt/1K2q7w2

It seems to make sense. The question is -- how do I get AWS Elastic BeanStalk to auto-install PG ?




Aucun commentaire:

Enregistrer un commentaire