告诉Bundler从特定gem的安装中排除某些gem

在gemfile中,有什么方法可以告诉Bundler:

gem 'twitter-bootstrap-rails', :exclude therubyracer 

我需要安装twitter-bootstrap-rails但是它会自动拉therubyracer ,因此bundle install失败并且bootstrap不包含在项目中,因为这是一台Windows机器。 我安装了execjs无济于事。

我试图在生产中列出therubyracer ,并bundle install --without production – 没有bundle install --without production ,也无济于事。

“ windows上的therubyracer gem ”也是这个问题,但没有任何建议改变了我得到的错误。

我的旧线程是“ 当我做”捆绑更新“时,我从gem中得到一个错误而不是我的gemfile。如何忽略这种依赖? ”。

在Bundler中没有这个选项。

所以你留下这些选择:

  • 不要使用twitter-bootstrap-rails 。 您只需将已编译的css和js文件复制到vendor/assets下的正确目录中即可。 你将失去改变较少变量的能力。 或者你可以使用compass_twitter_bootstrap gem,它使用sass而不是less。

  • 获得less gem的维护者使用execjs而不是commonjstherubyracer 。 如果可能的话,这可能意味着对维护者进行重大的重构。

  • 在Gemfile中使用:platform选项,仅在OSX或Linux上安装。 然后需要手工使用的零件,而不需要less装载。 这可能行不通。