Rebs
Rebs

Reputation: 4239

"cannot load such file -- bundler/setup (LoadError)" on Heroku

I know there are a number of these questions, but none seem to solve my issue.

I'm running ruby SASS via django-pipelines. During deployment, pipelines compiles some SASS files through the command python manage.py collectstatic --noinput which is done by Heroku automatically.

Previously I had no problems deploying this. I've recently come back to the code and now when I deploy to Heroku, I receive the following errors (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'.

As you can see, I've deployed using Ruby 2.2.2 previously, but now bundler has been updated on Heroku from 1.9.7 to 1.11.2.

Sass is the same version (3.4.19).

Line 14 of bin/sass from the last successful deployment on heroku.

$ 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

Curiously, the contents of my local version of bin/sass look nothing like the one on Heroku.

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

Locally, I'm running Ruby 2.2.2 and have tried both bundler 1.10.6 and 1.11.2. Here is my Gemfile:

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

Upvotes: 0

Views: 551

Answers (1)

Mike N
Mike N

Reputation: 26

I had the same problem as yours and found that the only solution was to switch out the SASS Compiler with Compass Compiler (installed with the django-pipeline-compass package). See Andrew's answer here: https://stackoverflow.com/a/31420009/6080975

Upvotes: 1

Related Questions