Elastic Beanstalk dependencies not available on npm install?

I read the EB Documentation to understand how I can install external dependencies for my application. My app needs to be installed in a nodejs container, which will automatically start npm install and run npm. So to create static dependencies, I use

"scripts": {
    "postinstall": "bower install -F && gulp build",
    "start": "node server.js",
    "test": "NODE_ENV=test mocha server/test --recursive"
  }

      

Which doesn't work fine because of a bug in gulp build that looks like this

[12:03:22] Starting 'styles'...
{ [Error: spawn ENOENT: Missing the Sass executable. Please install and make available on your PATH.]
  message: 'spawn ENOENT: Missing the Sass executable. Please install and make available on your PATH.',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-ruby-sass',
  __safety: { toString: [Function] } }
[12:03:22] 'css' all files 0 B

      

So I did this

packages:
  rubygems:
     sass: ''

      

and put the file in .ebextensions / 01config.config but no change in error. Tried many other things but ended up doing the following as my last idea.

   "postinstall": "bower install -F && gulp build && sh postgulp.sh",

      

and creating a postgulp.sh file in the root of the project

#!/bin/bash

pwd
ls

if hash sass 2>/dev/null; then
    sass --update ./client/css:./public-debug/css --sourcemap=auto;
else
    echo >&2 "I require sass but it not installed.  Continuing without sass.";
fi

      

Still no luck. Even though I have a Rubygem dependency but not in PATH. What for? When are ebextensions scripts executed as opposed to npm install and postinstall? Why is some thing that is set in ebextensions only available to these scripts and not npm? Why does dosent gulp-ruby-sass pick up sassi?

+3


source to share


1 answer


An instance can have two versions of ruby, one in / usr / bin and the other in / opt / elasticbeanstalk / lib / ruby.

Since you said SAAS is installed in the latter, you need to make sure the ruby ​​version in the path is the same when you start your application.



Most likely node is trying to use the system ruby ​​in / usr / bin and therefore cannot find the gem.

0


source







All Articles