Issue installing hiredis on AWS Linux using OpsWorks

371 views Asked by At

I'm using OpsWorks to deploy my custom node.js application. I'm not a Chef expert and thought this would be an easy process however I keep hitting snags. This most recent issue is really setting me back.

Basically I'm using a package called "Kue" which depends on a Node package called Hiredis. Hiredis is implemented at the C-level (as far as I understand) and uses some Python level compilation tools.

It seems that the default Chef script that OpsWorks uses keeps failing at the point where Kue then Hiredis is being installed. The following is the log when the instance attempts deploying the application: http://codepad.org/RXxKXqBq

Upon Googling some people are indicating its an issue with the Python version that AWS Linux is using. Note that I'm using the default Node.js application Chef recipes which can be found here: https://github.com/aws/opsworks-cookbooks/tree/release-chef-11.10/opsworks_nodejs

1

There are 1 answers

3
rastasheep On BEST ANSWER

I'm not that familiar with node packages and version compabylity but from log that you have shared it seems it's problem in one of the node packages that you're using called amdefine:

npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /home/deploy/.npm/amdefine/0.1.0/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Linux 3.14.26-24.46.amzn1.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--production"
npm ERR! cwd /srv/www/my_api/releases/20141214002817
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! file /home/deploy/.npm/amdefine/0.1.0/package/package.json

It can be fixed by npm cache clean or by changing version of nodejs, as you found too probably.

For adding command npm cache clean you must create new recipe or add it to your wrapper cookbook. Only thing that should be satisfied is that this command should be after installing node and before installing packages.

If yo want to change version, you can chceck default nodejs recepie you can see that requred version of installed nodejs is definded in attributes file for that cookbook.

So you can override default value with default[:opsworks_nodejs][:version] attribute.