簡體   English   中英

如何將帶有gruntfile的Node js應用程序部署到heroku

[英]How to deploy node js app with gruntfile to heroku

我正在嘗試使用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寶石來與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在節點buildpack中升級了ruby的版本?

我將分叉存儲庫並將值更改為正在尋找的2.2.0路徑值。

您只需更改buildpack中的路徑,或按照注釋中的說明進行操作。

我也剛開始遇到這個確切的問題,不確定heroku何時更改為ruby 2.2.0。 這是我制作的可修復PATH問題的buildpack的快速入門, https://github.com/adamgoldstein/heroku-buildpack-nodejs-grunt-compass

您可以使用以下命令在命令行上更改buildpack: heroku buildpacks:set https://github.com/adamgoldstein/heroku-buildpack-nodejs-grunt-compass

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM