【问题标题】:"cannot load such file -- bundler/setup (LoadError)" on HerokuHeroku 上的“无法加载此类文件——捆绑程序/设置(LoadError)”
【发布时间】:2016-03-17 23:58:26
【问题描述】:

我知道有很多这样的问题,但似乎没有一个能解决我的问题。

我正在通过 django-pipelines 运行 ruby​​ SASS。 在部署过程中,管道会通过命令python manage.py collectstatic --noinput 编译一些 SASS 文件,这由 Heroku 自动完成。

以前我在部署它时没有问题。我最近回到了代码,现在当我部署到 Heroku 时,我收到以下错误 (full error log can be found here):

         File "/app/.heroku/python/lib/python2.7/site-packages/pipeline/compilers/__init__.py", line 126, in execute_command
           "{0!r} exit code {1}\n{2}".format(argument_list, compiling.returncode, stderr))
       pipeline.exceptions.CompilerError: ['/usr/bin/env', 'sass', '--load-path', '/app/app/static', '--load-path', '/app/app2/static', u'/app/staticfiles/app2/stylesheets/app2.scss', u'/app/staticfiles/app2/stylesheets/app2.css'] exit code 1
       /tmp/build_8d2e04464970e15667c8f825fc387c8a/myapp-8b763976868799a3f147ac8cedbd82421efa7525/vendor/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
        from /tmp/build_8d2e04464970e15667c8f825fc387c8a/myapp-8b763976868799a3f147ac8cedbd82421efa7525/vendor/ruby-2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /tmp/build_8d2e04464970e15667c8f825fc387c8a/myapp-8b763976868799a3f147ac8cedbd82421efa7525/vendor/bundle/bin/sass:14:in `<main>'
 !     Error while running '$ python manage.py collectstatic --noinput'.

如您所见,我之前使用 Ruby 2.2.2 进行部署,但现在捆绑器已在 Heroku 上从 1.9.7 更新到 1.11.2。

Sass 是同一个版本(3.4.19)。

最后一次成功部署在 heroku 上的 bin/sass 的第 14 行。

$ sass --version
Sass 3.4.19 (Selective Steve)
$ cat ./vendor/bundle/bin/sass | sed '14!d'
require 'bundler/setup'
$ bundle --version
Bundler version 1.9.7

奇怪的是,我本地版本的 bin/sass 的内容与 Heroku 上的内容完全不同。

$ cat ~/.rvm/gems/ruby-2.2.2@app/bin/sass | sed '14!d'
  str = ARGV.first

在本地,我正在运行 Ruby 2.2.2 并尝试了捆绑程序 1.10.6 和 1.11.2。 这是我的 Gemfile:

source 'https://rubygems.org'
ruby '2.2.2'
gem 'sass', '3.4.19'

【问题讨论】:

    标签: python ruby django heroku


    【解决方案1】:

    我遇到了和你一样的问题,发现唯一的解决方案是用 Compass Compiler 切换 SASS Compiler(安装在 django-pipeline-compass 包中)。在这里查看安德鲁的答案:https://stackoverflow.com/a/31420009/6080975

    【讨论】:

    • 我找到的唯一解决方案是将 ruby​​ SASS 换成 python native libsass。这让我一起摆脱了红宝石。很好摆脱=P我担心python版本不会那么好,但我没有遇到任何问题。
    猜你喜欢
    • 2013-10-04
    • 2017-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多