jstoup111
jstoup111

Reputation: 108

Meteor Deployment failing on ElasticBeanstalk

loving MeteorJS so far. Perhaps those who have deployed to EB might be able to help me out.

I was able to deploy my app to EB successfully, however subsequent deployments are failing. During the npm install phase, I get an error message like so

  gyp ERR! node -v v0.10.42
  gyp ERR! node-gyp -v v1.0.1
  gyp ERR! not ok 

  npm ERR! [email protected] install: `node-gyp rebuild`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the [email protected] install script.
  npm ERR! This is most likely a problem with the bcrypt 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 bcrypt
  npm ERR! There is likely additional logging output above.
  npm ERR! System Linux 4.1.17-22.30.amzn1.x86_64
  npm ERR! command "/opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/npm" "--production" "rebuild"
  npm ERR! cwd /tmp/deployment/application
  npm ERR! node -v v0.10.42
  npm ERR! npm -v 1.4.29
  npm ERR! code ELIFECYCLE
  npm ERR! 
  npm ERR! Additional logging details can be found in:
  npm ERR!     /tmp/deployment/application/npm-debug.log
  npm ERR! not ok code 0
  Running npm install:  /opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/npm
  Setting npm config jobs to 1

I am using the iron CLI to build my app. The script I'm using to deploy looks a bit like this:

rm -Rf build/bundle

iron build --server=https://my-domain.com --architecture os.linux.x86_64

eb deploy prod

package.json at the root of the project looks like this:

{
  "name": "trail-status",
  "version": "2.0.0",
  "scripts": {
    "start": "node build/bundle/main.js"
  },
  "dependencies": {
    "fibers": "1.0.1",
    "underscore": "*",
    "source-map-support": "*",
    "semver": "*",
    "bcrypt": "*"
  }
}

I've tried removing build/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt without much luck. Also have tried removing bcrypt from the package.json.

Upvotes: 2

Views: 268

Answers (2)

jstoup111
jstoup111

Reputation: 108

I found the solution to this was using demeteorizer to build my project. Here's my script that works pretty well for deployments.

rm -Rf elasticbeanstalk
rm -Rf build.zip

cd app

demeteorizer -a os.linux.x86_64 -o ../elasticbeanstalk

cd ..

zip -r build.zip elasticbeanstalk .ebextensions/ .elasticbeanstalk/ config/production
rm -Rf elasticbeanstalk

eb deploy production

rm -Rf build.zip

Then in .ebextensions/configuration.config

files:
  "/opt/elasticbeanstalk/hooks/appdeploy/pre/51install_meteor.sh" :
    mode: "000755"
    user: root
    group: root
    encoding: plain
    content: |
      #!/usr/bin/env bash
      echo !!!  Setting up METEOR dependencies
      export PATH=$PATH:/usr/local/bin
      echo !!!  Set PATH: $PATH
      ln -s /opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/node /usr/local/bin/node
      ln -s /opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/npm /usr/local/bin/npm
      export HOME=/home/ec2-user
      echo !!!  Creating app bundle
      cd /tmp/deployment/application/elasticbeanstalk/bundle/programs/server
      npm install
      cd /usr/local/bin
      rm npm node

Upvotes: 1

hankchiutw
hankchiutw

Reputation: 1662

I've been met the issue. Check this discussion.

The solution may not be only one. Some solutions yo can try:

update gcc

# reinstall npm
npm install -g npm

# specify gcc
CC=/opt/local/bin/gcc CXX=/opt/local/bin/gcc npm install bcrypt

# add to package.json
"scripts": {
  "preinstall": "npm i -g node-gyp && node-gyp clean"
}

It's related to server environment. You may logon to your EB instance for more information(you can see it in EC2 console).

Upvotes: 0

Related Questions