我安装了Ruby,现在"捆绑安装"不起作用

时间:2016-12-18 18:48:00

标签: ruby ruby-on-rails-4 install bundle

我正在使用Rails 4.2.7。我下载了一个明显要求我使用Ruby 2.1.6而不是我安装的Ruby 2.3.0版本的示例...

localhost:lti_tool_provider_example-master davea$ bundle install
Your Ruby version is 2.3.0, but your Gemfile specified 2.1.6

这就是我所做的。但是在安装Ruby 2.1.6之后,现在“捆绑安装”不起作用......

localhost:lti_tool_provider_example-master davea$ rvm install ruby-2.1.6
Warning! PATH is not properly set up, '/Users/davea/.rvm/gems/ruby-2.3.0/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.3.0'.
Warning, new version of rvm available '1.27.0', you are using older version '1.26.11'.
You can disable this warning with:    echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable  auto-update  with:    echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.1.6.tar.bz2
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.1.6 - #configure
ruby-2.1.6 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 7630k  100 7630k    0     0  1199k      0  0:00:06  0:00:06 --:--:-- 1551k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.6 - #validate archive
ruby-2.1.6 - #extract
ruby-2.1.6 - #validate binary
Libraries missing for ruby-2.1.6: cannot. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Warning: DYLD_LIBRARY_PATH environment variable is set, this might interact with the compilation and ruby.
Installing Ruby from source to: /Users/davea/.rvm/rubies/ruby-2.1.6, this may take a while depending on your cpu(s)...
ruby-2.1.6 - #downloading ruby-2.1.6, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0  2272k      0  0:00:05  0:00:05 --:--:-- 2354k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.6 - #extracting ruby-2.1.6 to /Users/davea/.rvm/src/ruby-2.1.6....
ruby-2.1.6 - #configuring....................................................
ruby-2.1.6 - #post-configuration.
ruby-2.1.6 -    #compiling.......................................................................................................................................
ruby-2.1.6 - #installing...............
ruby-2.1.6 - #making binaries executable..
ruby-2.1.6 - #downloading rubygems-2.4.8
ruby-2.1.6 - #extracting rubygems-2.4.8.....
ruby-2.1.6 - #removing old rubygems.........
ruby-2.1.6 - #installing rubygems-2.4.8......................
ruby-2.1.6 - #gemset created /Users/davea/.rvm/gems/ruby-2.1.6@global
ruby-2.1.6 - #importing gemset /Users/davea/.rvm/gemsets/global.gems...............................................
ruby-2.1.6 - #generating global wrappers........
ruby-2.1.6 - #gemset created /Users/davea/.rvm/gems/ruby-2.1.6
ruby-2.1.6 - #importing gemsetfile /Users/davea/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.6 - #generating default wrappers........
ruby-2.1.6 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.1.6 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri
localhost:lti_tool_provider_example-master davea$ bundle install
-bash: bundle: command not found

如何在不干扰我刚刚安装的Ruby 2.1.3版本的情况下恢复“bundle”命令?

4 个答案:

答案 0 :(得分:4)

捆绑Ruby 2.1.6

您只需要安装bundler

rvm use ruby-2.1.6
gem install bundler

这将安装在特定于ruby-2.1.6的gemset中,因此它不会干扰您使用ruby-2.3.0安装的任何内容。你可以使用

bundle install

安装所需的宝石。

尝试使用Ruby 2.3.0

或者,您可以通过更改

来尝试使用ruby-2.3.0下载的示例
ruby '2.1.6'

将其从Gemfile中删除或删除。

答案 1 :(得分:1)

我遇到了同样的问题。就我而言,此问题的原因是由于两个 bundler gem 的冲突版本在版本号上非常接近。

tap()

问题出在捆绑器版本2.0.2和版本2.0.1

这就是我要解决的问题。

打开您的终端或命令行

bundler (2.0.2, 2.0.1, default: 1.17.2)

N / B:上面的命令适用于Linux用户,适用于Windows用户的命令可能不同

显示捆绑包宝石的所有本地宝石的列表

Ctrl + Alt + T

N / B:上面的命令用于rbenv版本管理器,用于rvm的命令可能不同

浏览捆绑器gem的显示版本,您会看到一些密切相关的冲突版本,例如以下版本

gem list bundler

卸载捆绑程序宝石

bundler (2.0.2, 2.0.1, default: 1.17.2)

安装捆绑包gem的新副本

gem uninstall bundler

尝试立即再次运行bundle install命令

gem install bundler

仅此而已

我希望这会有所帮助。

答案 2 :(得分:1)

只需执行以下操作

  1. 打开您的终端机
  2. 运行 gem卸载捆绑程序以卸载捆绑程序的早期版本
  3. 然后运行 gem install bundler 安装新的bundler副本

您现在可以运行

bundle install

这对我有用

答案 3 :(得分:0)

如上所述,您必须再次重新安装bundler gem(因为最后一个已经并且实际上已连接到您以前的版本,作为全局库,您实际上可以返回并将其设置为默认值再次看到捆绑包仍然存在,因为通常通过版本管理器rbenvrvm安装的所有ruby版本都将保存在您的计算机用户文件夹中。

逐步运行以下(以防万一)

  1. rvm list known
  2. 假设ruby-2.3.3是最新的或您想要使用的
  3. rvm install ruby-2.3.3
  4. rvm use --default 2.3.3
  5. gem install bundler
  6. bundle install
  7. 在我的情况下,我在rvm中的OSX rvm存储红宝石中也使用了OSX /Users/some_user/.rvm/rubies/default,所以请记住使用正确的rvm的ruby路径配置你的终端是什么,在这种情况下文件我应该加倍检查将为.bash_profile,我要查找的代码行将为export PATH=$PATH:/Users/some_user/.rvm/rubies/default

    希望这对于那些刚刚意识到rvmrbenv如何解决的人有用,我希望某种方式bundler成为的一部分过程将更像是core library本身(红宝石),而bundler则是完全分开的gem,这让我重新思考,这是一个多么宝石!方式去!鼓舞人心的!