Heroku上的“无法加载此文件 -- Bundler/Setup (LoadError)”

2024-04-26 13:55:42 发布

您现在位置:Python中文网/ 问答频道 /正文

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

我通过django管道运行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'.

如您所见,我以前使用Ruby2.2.2进行部署,但现在bundler在Heroku上已从1.9.7更新到1.11.2。在

Sass是相同的版本(3.4.19)。在

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

^{pr2}$

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

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

在本地,我运行的是ruby2.2.2,并尝试了bundler 1.10.6和1.11.2。 这是我的档案:

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

Tags: inpybuildappherokubinlib部署
1条回答
网友
1楼 · 发布于 2024-04-26 13:55:42

我遇到了与您相同的问题,并且发现唯一的解决方案是用Compass编译器(与django-pipeline-compass包一起安装)关闭SASS编译器。请看安德鲁的回答:https://stackoverflow.com/a/31420009/6080975

相关问题 更多 >