标签: gemfile

如何为Gemfile指定最小Bundler版本?

当我的Gemfile正在使用:mri_20,以及以前版本的bundler不支持时,添加是个好主意

gem 'bundler', '~>1.3.5'
Run Code Online (Sandbox Code Playgroud)

到Gemfile?有没有更好的方法来强制执行最低捆绑器版本?

ruby bundler gemfile

12
推荐指数
1
解决办法
4153
查看次数

该捆绑目前的铁轨锁定在4.0.4

Gemfile我做了以下改变:

-bash> git diff Gemfile
...
-gem 'rails', '4.0.4'
+gem 'rails', '4.0.5'
Run Code Online (Sandbox Code Playgroud)

然后我跑了bundle,得到一个停止显示的消息:

-bash> bundle
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
You have requested:
  rails = 4.0.5

The bundle currently has rails locked at 4.0.4.
Try running `bundle update rails`
Run Code Online (Sandbox Code Playgroud)

然后我bundle update rails根据上面的消息跑了,得到了以下内容(注意我正在跳线而没有变化).

-bash> bundle update rails
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 10.3.2 (was 10.3.0)
Installing multi_json …
Run Code Online (Sandbox Code Playgroud)

bundle ruby-on-rails upgrade gemfile ruby-on-rails-4

12
推荐指数
1
解决办法
2万
查看次数

如何通过Gemfile"gem install nokogiri - --use-system-libraries"

安装最新版本的Nokogiri有一个已知错误.解决方法是使用手动安装

gem install nokogiri -- --use-system-libraries
Run Code Online (Sandbox Code Playgroud)

但是如何通过Gemfile来完成呢?

ruby rubygems nokogiri bundler gemfile

12
推荐指数
2
解决办法
5698
查看次数

Ruby中的"Gemfile"在哪里?

我经常在互联网上的文档中看到"把它放在Gemfile中".我不知道这个"Gemfile"在哪里和什么.如果我安装了gem,那么我已经安装了它.谁需要比"Gemfile"?Gemfile的位置或内容,以及为什么使用它?

ruby install rubygems gemfile

12
推荐指数
2
解决办法
2万
查看次数

无法使用捆绑锁将平台添加到 Gemfile.lock

我正在尝试第一次使用git push heroku master. 但是,我最终收到以下错误:

您的捆绑包仅支持平台 [“arm64-darwin-21”],但您的本地平台是 x86_64-linux。将当前平台添加到锁定文件中,bundle lock --add-platform x86_64-linux然后重试。

bundle lock --add-platform x86_64-linux依次运行会产生以下输出:

[17052,#<线程:0x000000015307bc60 run>,#<NameError:未初始化的常量 Gem::Source

...后面是我计算机上一百行不同的路径。

有谁知道如何解释和解决这种输出?

非常感谢您的帮助!

heroku gemfile gemfile.lock

12
推荐指数
2
解决办法
7675
查看次数

我如何在我的gemspec中使用github的依赖?

我目前在我的Gemfile中有以下内容:

gem 'voteable_mongo'#,       :github => 'kamilski81/voteable_mongo'
Run Code Online (Sandbox Code Playgroud)

我将我的模型迁移到.gemspec中,但我不确定这将在我的gemspec中看起来如何.我目前有:

s.add_dependency "voteable_mongo"
Run Code Online (Sandbox Code Playgroud)

但这最终会使用错误的依赖(我克隆的原始的)我想使用我的依赖.我怎么能将我的gemspec依赖指向我的github repo?

ruby gemspecs gemfile

11
推荐指数
1
解决办法
3709
查看次数

用于开发的本地宝石路径和用于生产的远程Git回购

我有一个我正在本地工作的宝石,由项目使用.

如果我在中指定了gem的位置path,我可以进行更改,项目会选择新的代码:

gem 'example', :path => "~/path/to/gems/example"
Run Code Online (Sandbox Code Playgroud)

但是,当我推送到Heroku时,捆绑失败,因为Heroku无法访问本地计算机上的gem源.

所以我可以将宝石源推送到远程仓库并将宝石源指向那里:

gem 'example', :github => 'example/example', :branch => 'example_feature'
Run Code Online (Sandbox Code Playgroud)

但是我现在需要将更改推送到此repo,然后更新gem以获取项目中的新变化:

$ cd ~/path/to/gems/example
$ git c -a -m "Update gem"
$ git push origin example_feature
$ cd ~/path/to/projects/project
$ gem update example
Run Code Online (Sandbox Code Playgroud)

通过为我的本地仓库设置本地覆盖,我可以减轻这种痛苦:

$ bundle config local.example ~/path/to/gems/example
Run Code Online (Sandbox Code Playgroud)

但我仍然需要将更改的文件添加到git,commit,然后$ gem update example每次我更改gem源,如果我想在我的项目中进行新的更改.

有没有办法让我的项目自动获取本地更改(就像我使用时一样path),但仍然在生产中使用远程仓库?

ruby gem bundle ruby-on-rails gemfile

11
推荐指数
1
解决办法
5309
查看次数

(Rails 5) LoadError: 无法加载此类文件 -- sass ...部署到 Heroku 时

当我部署 Rails 5 应用程序时,我收到标题中的错误。我最近更新了 Gemfile 以包含一些更新的版本。我的本地开发环境没有任何问题,但是当我推送到处于“生产模式”的 Heroku 时,出现一个错误,该错误似乎与资产预编译有关。

这是我在日志中看到的内容:

remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.22.10
remote:        [1/5] Validating package.json...
remote:        [2/5] Resolving packages...
remote:        success Nothing to install.
remote:        success Saved lockfile.
remote:        Done in 0.07s.
remote:        rake aborted!
remote:        LoadError: cannot load such file -- sass
remote:        /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
remote:        /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
remote:        /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:        /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
remote:        /tmp/build_fbac64d9/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/autoload/sass.rb:1:in `<top (required)>' …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku gemfile

11
推荐指数
2
解决办法
2万
查看次数

由于"mysql2"gem,我无法运行"bundle update"

我在Gemfile中有这个:

gem 'mysql2'
Run Code Online (Sandbox Code Playgroud)

但是当我运行bundle update时,我收到以下错误消息:

An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)

我试着把它移到生产部分,像这样:

group :production do
  gem 'mysql2'
end
Run Code Online (Sandbox Code Playgroud)

但是在运行bundle更新后,结果是一样的.此部分仅在生产模式下处理,或不处理?

如何摆脱localhost上的此错误消息?

编辑:整个错误消息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/radek/.rvm/rubies/ruby-1.9.3-p385/bin/ruby extconf.rb
checking for ruby/thread.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details. …
Run Code Online (Sandbox Code Playgroud)

ruby mysql gem ruby-on-rails gemfile

10
推荐指数
2
解决办法
1万
查看次数

当尝试升级到Rails 5时,得到"Bundler无法找到gem的兼容版本"栏杆""错误

我正在尝试升级到Rails 5.我删除了我的Gemfile.lock文件,编辑了我的Gemfile,如下所示

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem …
Run Code Online (Sandbox Code Playgroud)

rubygems ruby-on-rails gemfile ruby-on-rails-4

10
推荐指数
1
解决办法
8571
查看次数