告诉 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
,也无济于事。
“therubyracer gem on windows”也是这个问题,但是那里的建议都没有改变错误我明白了。
我的旧线程是“当我执行“捆绑更新”时,我收到来自不在我的 gemfile 中的 gem 的错误。我该如何忽略这种依赖性?”。
Within a gemfile, is there any way to tell Bundler something like:
gem 'twitter-bootstrap-rails', :exclude therubyracer
I need to install twitter-bootstrap-rails but it automatically pulls therubyracer
in, so bundle install
fails and bootstrap isn't included in the project since this is a Windows machine. I installed execjs to no avail.
I tried to list therubyracer
under production, and bundle install --without production
, also to no avail.
"therubyracer gem on windows" is also this problem, but none of the suggestions there change the error I'm getting.
My old thread was "When I do "bundle update", I get an error from a gem not in my gemfile. How do I ignore this dependency?".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Bundler 中没有此选项。
因此,您只剩下以下选项:
不要使用
twitter-bootstrap-rails
。您只需将编译后的 css 和 js 文件复制到vendor/assets
下的适当目录中即可。你将失去改变较少变量的能力。或者您可以使用compass_twitter_bootstrap
gem,它使用 sass 而不是 less。让
less
gem 的维护者使用execjs
而不是commonjs
和therubyracer
。如果可能的话,这可能意味着维护者需要进行重大重构。在 Gemfile 中使用
:platform
选项,仅在 OSX 或 Linux 上安装。然后需要您可以手动使用的部件,而无需加载less
。这可能行不通。There is no option for this in Bundler.
So you're left with these options:
Don't use
twitter-bootstrap-rails
. You can just copy the compiled css and js files into the proper directories undervendor/assets
. You'll lose the ability to change less variables. Or you can use thecompass_twitter_bootstrap
gem, which uses sass instead of less.Get the maintainer of the
less
gem to useexecjs
instead ofcommonjs
andtherubyracer
. It would probably mean significant refactoring for the maintainer(s) if at all possible.Use the
:platform
option in your Gemfile, to only install on OSX or Linux. Then require the parts you can use by hand, without loadingless
. This probably won't work.