我正在尝试使用 BUILDPACK_URL
将 Node js 应用程序部署到 Heroku。我已经搜索了我的问题的解决方案,但没有得到任何适合我的问题的答案。
这是我遵循的过程:
heroku create myapp
heroku config:add BUILDPACK_URL='https://github.com/stephanmelzer/heroku-buildpack-nodejs-grunt-compass.git'
然后我提交更改,然后:
git push heroku master
它在grunt
任务启动之前运行良好。我已经安装了compass
gem来使用grunt。
当 Heroku 尝试启动 grunt 任务时,我收到以下错误:
`remote: -----> Installing Compass
remote: WARNING: You don't have /tmp/build_2f866d4293332f62a9a9aa576a411628/.gem/ruby/2.2.0/bin in your PATH,
remote:gem executables will not run.
`
在该警告之后,我收到一条消息,表明指南针安装成功
remote: Building native extensions. This could take a while...
remote: Successfully installed ffi-1.9.10
remote: Successfully installed rb-inotify-0.9.5
remote: Successfully installed rb-fsevent-0.9.5
remote: Successfully installed chunky_png-1.3.4
remote: Successfully installed sass-3.4.16
remote: Successfully installed compass-import-once-1.0.5
remote: Successfully installed compass-core-1.0.3
remote: Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
remote: Successfully installed compass-1.0.3
remote: 8 gems installed
然后在heroku尝试运行“grunt”之后。此时我收到以下错误:
remote: -----> Running grunt heroku:production task
remote: Running "env:src" (env) task
remote:
remote: Running "clean:dist" (clean) task
remote:
remote: Running "compass:dist" (compass) task
remote: Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass Use --force to continue.
remote:
remote: Aborted due to warnings.
我不明白为什么它找不到已安装在我的本地计算机中的 compass
gem 的 PATH
。
which compass
result: /home/username/.rvm/gems/ruby-2.2.0-preview1/bin/compass
谁能告诉我如何克服这个问题并正确设置gem的PATH
变量吗?
非常感谢。
最佳答案
我刚刚查看了构建源代码,并在 bin/compile 中看到两次它引用了 ruby 1.9.1。两次都设置环境变量。
也许heroku升级了 Node 构建包中的ruby版本?
我会 fork 存储库并将值更改为正在查找的 2.2.0 路径值。
您只需更改构建包中的路径,或按照评论中的说明进行操作。
关于javascript - 如何使用 gruntfile 将 Node js 应用程序部署到 heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31987088/