我正在尝试将一个应用程序部署到Heroku,使用bundler安装SASS / Compass和gulp.js(使用gulp-ruby-sass
在部署时构建CSS文件.Ruby buildpack首先执行并安装gem但bundle
/ vendor/bundle
在nodejs buildpack中没有添加到PATH。我似乎无法让Gulp识别bundle
命令以便可以调用SASS / Compass 。gulp-ruby-sass
只会调用“bundle exec”,所以即使bundle命令可用,也不一定需要Bundler可执行文件。
Gulp任务:
gulp.task('styles', function() {
return gulp.src(paths.styles.src)
.pipe(sass({
compass: true,
bundleExec: true
}))
.pipe(minifyCSS())
.pipe(gulp.dest(paths.styles.dest));
});
我的postinstall挂钩:
"postinstall": "echo $PATH && ./node_modules/.bin/bower install --allow-root && ./node_modules/.bin/gulp"
部署过程的相关部分(您可以看到我在postinstall脚本中回显PATH以进行调试):
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
感谢任何帮助。我没有想法。