2

I'm trying to deploy an app to Heroku that is using bundler to install SASS/Compass and gulp.js (with gulp-ruby-sass to build the CSS files on deploy. The Ruby buildpack executes first and installs the gems but bundle/vendor/bundle isn't added to the PATH while inside the nodejs buildpack. I can't seem to get Gulp to recognize the bundle command so that SASS/Compass can be called. gulp-ruby-sass will simply call "bundle exec" so even if the bundle command is available, the bundler executables don't necessarily need to be.

Gulp task:

gulp.task('styles', function() {
  return gulp.src(paths.styles.src)
    .pipe(sass({
      compass: true,
      bundleExec: true
    }))
    .pipe(minifyCSS())
    .pipe(gulp.dest(paths.styles.dest));
});

My postinstall hook:

"postinstall": "echo $PATH && ./node_modules/.bin/bower install --allow-root && ./node_modules/.bin/gulp"

Relevant part of the deploy process (you can see I echo the PATH in the postinstall script to debug):

Fetching repository, done.
Counting objects: 12, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.31 KiB | 0 bytes/s, done.
Total 12 (delta 9), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
=====> Detected Framework: Ruby
-----> Compiling Ruby
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using 1.6.3
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Using chunky_png 1.3.0
       Using sass 3.2.19
       Using bundler 1.6.3
       Using fssm 0.2.10
       Using compass 0.12.5
       Your bundle is complete!
       Gems in the groups development and test were not installed.
       It was installed into ./vendor/bundle
       Bundle completed (0.78s)
       Cleaning up the bundler cache.

=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js

       PRO TIP: Specify a node version in package.json
       See https://devcenter.heroku.com/articles/nodejs-support

-----> Defaulting to latest stable node: 0.10.33
-----> Downloading and installing node
-----> Restoring node_modules directory from cache
-----> Pruning cached dependencies not specified in package.json
-----> Exporting config vars to environment
-----> Installing dependencies

       > App@0.0.1 postinstall /tmp/build_ea48c721ae490fe3e5860ba1bafed484
       > echo $PATH && ./node_modules/.bin/bower install --allow-root && ./node_modules/.bin/gulp

       /tmp/build_ea48c721ae490fe3e5860ba1bafed484/vendor/node/lib/node_modules/npm/bin/node-gyp-bin:/tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/.bin:/tmp/build_ea48c721ae490fe3e5860ba1bafed484/vendor/node/bin:/tmp/build_ea48c721ae490fe3e5860ba1bafed484/vendor/node/bin::/tmp/codon/vendor/bin:/app/bin:/usr/ruby1.9.2/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
       bower foundation#*          not-cached git://github.com/zurb/bower-foundation.git#*
       bower foundation#*             resolve git://github.com/zurb/bower-foundation.git#*
       bower foundation#*            download https://github.com/zurb/bower-foundation/archive/5.4.7.tar.gz
       bower moment#~2.6.0         not-cached git://github.com/moment/moment.git#~2.6.0
       bower moment#~2.6.0            resolve git://github.com/moment/moment.git#~2.6.0
       bower angular#~1.3.0        not-cached git://github.com/angular/bower-angular.git#~1.3.0
       bower angular#~1.3.0           resolve git://github.com/angular/bower-angular.git#~1.3.0
       bower angular-route#~1.3.0  not-cached git://github.com/angular/bower-angular-route.git#~1.3.0
       bower angular-route#~1.3.0     resolve git://github.com/angular/bower-angular-route.git#~1.3.0
       bower jquery-waypoints#~2.0.5       not-cached git://github.com/imakewebthings/jquery-waypoints.git#~2.0.5
       bower jquery-waypoints#~2.0.5          resolve git://github.com/imakewebthings/jquery-waypoints.git#~2.0.5
       bower angular-resource#~1.3.0       not-cached git://github.com/angular/bower-angular-resource.git#~1.3.0
       bower angular-resource#~1.3.0          resolve git://github.com/angular/bower-angular-resource.git#~1.3.0
       bower angular-foundation#~0.2.0     not-cached git://github.com/pineconellc/angular-foundation-bower.git#~0.2.0
       bower angular-foundation#~0.2.0        resolve git://github.com/pineconellc/angular-foundation-bower.git#~0.2.0
       bower angular-pusher#~0.0.7         not-cached git://github.com/doowb/angular-pusher.git#~0.0.7
       bower angular-pusher#~0.0.7            resolve git://github.com/doowb/angular-pusher.git#~0.0.7
       bower jquery.lazyload#~1.9.3        not-cached git://github.com/tuupola/jquery_lazyload.git#~1.9.3
       bower jquery.lazyload#~1.9.3           resolve git://github.com/tuupola/jquery_lazyload.git#~1.9.3
       bower jquery-waypoints#~2.0.5         download https://github.com/imakewebthings/jquery-waypoints/archive/v2.0.5.tar.gz
       bower moment#~2.6.0                   download https://github.com/moment/moment/archive/2.6.0.tar.gz
       bower angular-route#~1.3.0            download https://github.com/angular/bower-angular-route/archive/v1.3.0.tar.gz
       bower angular#~1.3.0                  download https://github.com/angular/bower-angular/archive/v1.3.0.tar.gz
       bower angular-foundation#~0.2.0       download https://github.com/pineconellc/angular-foundation-bower/archive/v0.2.2.tar.gz
       bower angular-resource#~1.3.0         download https://github.com/angular/bower-angular-resource/archive/v1.3.0.tar.gz
       bower jquery.lazyload#~1.9.3          download https://github.com/tuupola/jquery_lazyload/archive/1.9.3.tar.gz
       bower angular-pusher#~0.0.7           download https://github.com/doowb/angular-pusher/archive/v0.0.13.tar.gz
       bower foundation#*                     extract archive.tar.gz
       bower jquery-waypoints#~2.0.5          extract archive.tar.gz
       bower angular-foundation#~0.2.0        extract archive.tar.gz
       bower angular-route#~1.3.0             extract archive.tar.gz
       bower angular-resource#~1.3.0          extract archive.tar.gz
       bower angular-pusher#~0.0.7            extract archive.tar.gz
       bower moment#~2.6.0                    extract archive.tar.gz
       bower angular#~1.3.0                   extract archive.tar.gz
       bower jquery.lazyload#~1.9.3           extract archive.tar.gz
       bower angular-pusher#~0.0.7           resolved git://github.com/doowb/angular-pusher.git#0.0.13
       bower angular#~1.2.0                not-cached git://github.com/angular/bower-angular.git#~1.2.0
       bower angular#~1.2.0                   resolve git://github.com/angular/bower-angular.git#~1.2.0
       bower angular#~1.2.0                  download https://github.com/angular/bower-angular/archive/v1.2.26.tar.gz
       bower angular-resource#~1.3.0         resolved git://github.com/angular/bower-angular-resource.git#1.3.0
       bower angular#1.3.0                 not-cached git://github.com/angular/bower-angular.git#1.3.0
       bower angular#1.3.0                    resolve git://github.com/angular/bower-angular.git#1.3.0
       bower angular#1.3.0                   download https://github.com/angular/bower-angular/archive/v1.3.0.tar.gz
       bower angular-route#~1.3.0            resolved git://github.com/angular/bower-angular-route.git#1.3.0
       bower angular#~1.2.0                   extract archive.tar.gz
       bower angular#1.3.0                    extract archive.tar.gz
       bower angular-foundation#~0.2.0       resolved git://github.com/pineconellc/angular-foundation-bower.git#0.2.2
       bower angular#>=1                   not-cached git://github.com/angular/bower-angular.git#>=1
       bower angular#>=1                      resolve git://github.com/angular/bower-angular.git#>=1
       bower angular#>=1                     download https://github.com/angular/bower-angular/archive/v1.3.0.tar.gz
       bower angular#>=1                      extract archive.tar.gz
       bower jquery-waypoints#~2.0.5         resolved git://github.com/imakewebthings/jquery-waypoints.git#2.0.5
       bower jquery#>=1.8                  not-cached git://github.com/jquery/jquery.git#>=1.8
       bower jquery#>=1.8                     resolve git://github.com/jquery/jquery.git#>=1.8
       bower jquery#>=1.8                    download https://github.com/jquery/jquery/archive/2.1.1.tar.gz
       bower jquery#>=1.8                     extract archive.tar.gz
       bower jquery.lazyload#~1.9.3          resolved git://github.com/tuupola/jquery_lazyload.git#1.9.3
       bower angular#~1.2.0                  resolved git://github.com/angular/bower-angular.git#1.2.26
       bower angular#~1.3.0                  resolved git://github.com/angular/bower-angular.git#1.3.0
       bower angular#1.3.0                   resolved git://github.com/angular/bower-angular.git#1.3.0
       bower foundation#*                    resolved git://github.com/zurb/bower-foundation.git#5.4.7
       bower jquery#>= 2.1.0               not-cached git://github.com/jquery/jquery.git#>= 2.1.0
       bower jquery#>= 2.1.0                  resolve git://github.com/jquery/jquery.git#>= 2.1.0
       bower jquery#>= 2.1.0                 download https://github.com/jquery/jquery/archive/2.1.1.tar.gz
       bower fastclick#>=0.6.11            not-cached git://github.com/ftlabs/fastclick.git#>=0.6.11
       bower fastclick#>=0.6.11               resolve git://github.com/ftlabs/fastclick.git#>=0.6.11
       bower jquery-placeholder#~2.0.7     not-cached git://github.com/mathiasbynens/jquery-placeholder.git#~2.0.7
       bower jquery-placeholder#~2.0.7        resolve git://github.com/mathiasbynens/jquery-placeholder.git#~2.0.7
       bower modernizr#>= 2.7.2            not-cached git://github.com/Modernizr/Modernizr.git#>= 2.7.2
       bower modernizr#>= 2.7.2               resolve git://github.com/Modernizr/Modernizr.git#>= 2.7.2
       bower jquery.cookie#~1.4.0          not-cached git://github.com/carhartl/jquery-cookie.git#~1.4.0
       bower jquery.cookie#~1.4.0             resolve git://github.com/carhartl/jquery-cookie.git#~1.4.0
       bower jquery-placeholder#~2.0.7       download https://github.com/mathiasbynens/jquery-placeholder/archive/v2.0.8.tar.gz
       bower fastclick#>=0.6.11              download https://github.com/ftlabs/fastclick/archive/v1.0.3.tar.gz
       bower modernizr#>= 2.7.2              download https://github.com/Modernizr/Modernizr/archive/v2.8.3.tar.gz
       bower jquery.cookie#~1.4.0            download https://github.com/carhartl/jquery-cookie/archive/v1.4.1.tar.gz
       bower fastclick#>=0.6.11               extract archive.tar.gz
       bower jquery-placeholder#~2.0.7        extract archive.tar.gz
       bower jquery#>= 2.1.0                  extract archive.tar.gz
       bower jquery.cookie#~1.4.0             extract archive.tar.gz
       bower modernizr#>= 2.7.2               extract archive.tar.gz
       bower angular#>=1                     resolved git://github.com/angular/bower-angular.git#1.3.0
       bower jquery-placeholder#~2.0.7       resolved git://github.com/mathiasbynens/jquery-placeholder.git#2.0.8
       bower jquery.cookie#~1.4.0            resolved git://github.com/carhartl/jquery-cookie.git#1.4.1
       bower jquery#>=1.2                  not-cached git://github.com/jquery/jquery.git#>=1.2
       bower jquery#>=1.2                     resolve git://github.com/jquery/jquery.git#>=1.2
       bower jquery#>=1.2                    download https://github.com/jquery/jquery/archive/2.1.1.tar.gz
       bower jquery#>=1.2                     extract archive.tar.gz
       bower fastclick#>=0.6.11              resolved git://github.com/ftlabs/fastclick.git#1.0.3
       bower moment#~2.6.0                   resolved git://github.com/moment/moment.git#2.6.0
       bower modernizr#>= 2.7.2              resolved git://github.com/Modernizr/Modernizr.git#2.8.3
       bower jquery#>=1.8                    resolved git://github.com/jquery/jquery.git#2.1.1
       bower jquery#>= 2.1.0                 resolved git://github.com/jquery/jquery.git#2.1.1
       bower jquery#>=1.2                    resolved git://github.com/jquery/jquery.git#2.1.1

       Please note that,
           angular-pusher#0.0.13 depends on angular#~1.2.0 which resolved to angular#1.2.26
           angular-resource#1.3.0, angular-route#1.3.0 depends on angular#1.3.0 which resolved to angular#1.3.0
           app depends on angular#~1.3.0 which resolved to angular#1.3.0
           angular-foundation#0.2.2 depends on angular#>=1 which resolved to angular#1.3.0

       Resort to using angular#~1.3.0 which resolved to angular#1.3.0
       Code incompatibilities may occur.

       bower angular-pusher#~0.0.7            install angular-pusher#0.0.13
       bower angular-resource#~1.3.0          install angular-resource#1.3.0
       bower angular-route#~1.3.0             install angular-route#1.3.0
       bower angular-foundation#~0.2.0        install angular-foundation#0.2.2
       bower jquery-waypoints#~2.0.5          install jquery-waypoints#2.0.5
       bower jquery.lazyload#~1.9.3           install jquery.lazyload#1.9.3
       bower angular#1.3.0                    install angular#1.3.0
       bower foundation#*                     install foundation#5.4.7
       bower jquery-placeholder#~2.0.7        install jquery-placeholder#2.0.8
       bower jquery.cookie#~1.4.0             install jquery.cookie#1.4.1
       bower fastclick#>=0.6.11               install fastclick#1.0.3
       bower moment#~2.6.0                    install moment#2.6.0
       bower modernizr#>= 2.7.2               install modernizr#2.8.3
       bower jquery#>=1.8                     install jquery#2.1.1

       angular-pusher#0.0.13 app/static/bower_components/angular-pusher
       └── angular#1.3.0

       angular-resource#1.3.0 app/static/bower_components/angular-resource
       └── angular#1.3.0

       angular-route#1.3.0 app/static/bower_components/angular-route
       └── angular#1.3.0

       angular-foundation#0.2.2 app/static/bower_components/angular-foundation
       └── angular#1.3.0

       jquery-waypoints#2.0.5 app/static/bower_components/jquery-waypoints
       └── jquery#2.1.1

       jquery.lazyload#1.9.3 app/static/bower_components/jquery.lazyload

       angular#1.3.0 app/static/bower_components/angular

       foundation#5.4.7 app/static/bower_components/foundation
       ├── fastclick#1.0.3
       ├── jquery#2.1.1
       ├── jquery-placeholder#2.0.8
       ├── jquery.cookie#1.4.1
       └── modernizr#2.8.3

       jquery-placeholder#2.0.8 app/static/bower_components/jquery-placeholder

       jquery.cookie#1.4.1 app/static/bower_components/jquery.cookie
       └── jquery#2.1.1

       fastclick#1.0.3 app/static/bower_components/fastclick

       moment#2.6.0 app/static/bower_components/moment

       modernizr#2.8.3 app/static/bower_components/modernizr

       jquery#2.1.1 app/static/bower_components/jquery
       [17:37:38] Using gulpfile /tmp/build_ea48c721ae490fe3e5860ba1bafed484/gulpfile.js
       [17:37:38] Starting 'scripts'...
       [17:37:38] Starting 'styles'...
       [17:37:38] 'styles' errored after 3.3 ms
       [17:37:38] [gulp] Error in plugin 'gulp-ruby-sass': You need to have Ruby and Sass installed and in your PATH for this task to work.
           at module.exports (/tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/gulp-ruby-sass/index.js:21:10)
           at Gulp.<anonymous> (/tmp/build_ea48c721ae490fe3e5860ba1bafed484/gulpfile.js:29:11)
           at module.exports (/tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
           at Gulp.Orchestrator._runTask (/tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
           at Gulp.Orchestrator._runStep (/tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
           at Gulp.Orchestrator.start (/tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
           at /tmp/build_ea48c721ae490fe3e5860ba1bafed484/node_modules/gulp/bin/gulp.js:129:20
           at process._tickCallback (node.js:419:13)
           at Function.Module.runMain (module.js:499:11)
           at startup (node.js:119:16)
       [17:37:49] Finished 'scripts' after 11 s

Any help is appreciated. I'm out of ideas.

Andrew Ryno
  • 659
  • 1
  • 7
  • 17
  • did you ever solve your problem? I have a similar problem invoking rake from a later buildpack compile script – hammady Nov 17 '14 at 18:55
  • @hammady Nope, I gave up and am just running my Gulp tasks locally to generate the minified app, committing it, and pushing that to Heroku. – Andrew Ryno Nov 17 '14 at 22:53
  • @hammady Looks like the multi buildpacks extension supports this, and they will be working on getting it in the Ruby buildpack soon: https://github.com/heroku/heroku-buildpack-ruby/pull/319/files – Andrew Ryno Nov 26 '14 at 04:55
  • I am already using multipack but the paths are not passed from one build to another. I hope the above pull will be merged – hammady Dec 04 '14 at 06:06

0 Answers0