Rails:我安装了 Ruby,现在 "bundle install" 不起作用
Rails: I installed Ruby, now "bundle install" doesn't work
我正在使用 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 版本的情况下恢复“捆绑”命令?
捆绑 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
安装所需的 gem。
尝试 Ruby 2.3.0
或者,您可以尝试使用 ruby-2.3.0 下载的示例,方法是更改
ruby '2.1.6'
行或从 Gemfile
.
中删除它
如上所述,你必须再次re-install bundler gem
(因为最后一个是并且实际上是附加到你之前的版本,作为全局库,你实际上可以返回并设置再次将其设置为默认值并看到捆绑器仍然存在,因为通常所有 ruby 您通过版本管理器 rbenv
或 rvm
安装的版本都将保存在本地机器用户的文件夹中。
循序渐进运行以下(以防万一)
rvm list known
- 假设
ruby-2.3.3
是最新的或您要使用的
rvm install ruby-2.3.3
rvm use --default 2.3.3
gem install bundler
bundle install
在我的例子中,我在 OSX 中使用 OSX 也在 rvm
rvm store rubies 在 /Users/some_user/.rvm/rubies/default
所以只要记住用正确的 rvm 配置你的终端ruby 路径在这种情况下,我应该仔细检查的文件将是 .bash_profile
,我要查找的代码行将是 export PATH=$PATH:/Users/some_user/.rvm/rubies/default
希望这对刚刚了解 rvm
和 rbenv
如何解决的人有所帮助,我以某种方式期望 bundler
是 key 过程的一部分更像是一个 core library
本身 (ruby),但 bundler
是一个完全分离的 gem
,这让我回想起,多么 gem!干得好!鼓舞人心的一个!
我遇到了同样的问题。对于我的情况,问题的原因是 bundler gem 的两个冲突版本,它们的版本号非常接近。
bundler (2.0.2, 2.0.1, default: 1.17.2)
问题出在捆绑器版本 2.0.2 和版本 2.0.1
这就是我修复它的方法。
打开终端或命令行
Ctrl + Alt + T
N/B:上面的命令是针对Linux用户的,针对Windows用户的命令可能会有所不同
显示捆绑器 gem
的所有本地 gem 的列表
gem list bundler
N/B: 上面的命令是针对 rbenv 版本管理器的,针对 rvm 的命令可能不同
查看显示的捆绑器版本 gem,您会看到一些密切相关的冲突版本,如下面的版本
bundler (2.0.2, 2.0.1, default: 1.17.2)
卸载捆绑器gem
gem uninstall bundler
安装捆绑器的新副本gem
gem install bundler
现在再次尝试 运行 捆绑安装命令
bundle install
就这些了
希望对您有所帮助。
只需执行以下操作
- 打开终端
- 运行 gem uninstall bundler 卸载以前版本的 bundler
- 然后运行 gem install bundler 安装一个新的bundler
您现在可以运行
bundle install
这对我有用
我正在使用 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 版本的情况下恢复“捆绑”命令?
捆绑 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
安装所需的 gem。
尝试 Ruby 2.3.0
或者,您可以尝试使用 ruby-2.3.0 下载的示例,方法是更改
ruby '2.1.6'
行或从 Gemfile
.
如上所述,你必须再次re-install bundler gem
(因为最后一个是并且实际上是附加到你之前的版本,作为全局库,你实际上可以返回并设置再次将其设置为默认值并看到捆绑器仍然存在,因为通常所有 ruby 您通过版本管理器 rbenv
或 rvm
安装的版本都将保存在本地机器用户的文件夹中。
循序渐进运行以下(以防万一)
rvm list known
- 假设
ruby-2.3.3
是最新的或您要使用的 rvm install ruby-2.3.3
rvm use --default 2.3.3
gem install bundler
bundle install
在我的例子中,我在 OSX 中使用 OSX 也在 rvm
rvm store rubies 在 /Users/some_user/.rvm/rubies/default
所以只要记住用正确的 rvm 配置你的终端ruby 路径在这种情况下,我应该仔细检查的文件将是 .bash_profile
,我要查找的代码行将是 export PATH=$PATH:/Users/some_user/.rvm/rubies/default
希望这对刚刚了解 rvm
和 rbenv
如何解决的人有所帮助,我以某种方式期望 bundler
是 key 过程的一部分更像是一个 core library
本身 (ruby),但 bundler
是一个完全分离的 gem
,这让我回想起,多么 gem!干得好!鼓舞人心的一个!
我遇到了同样的问题。对于我的情况,问题的原因是 bundler gem 的两个冲突版本,它们的版本号非常接近。
bundler (2.0.2, 2.0.1, default: 1.17.2)
问题出在捆绑器版本 2.0.2 和版本 2.0.1
这就是我修复它的方法。
打开终端或命令行
Ctrl + Alt + T
N/B:上面的命令是针对Linux用户的,针对Windows用户的命令可能会有所不同
显示捆绑器 gem
的所有本地 gem 的列表gem list bundler
N/B: 上面的命令是针对 rbenv 版本管理器的,针对 rvm 的命令可能不同
查看显示的捆绑器版本 gem,您会看到一些密切相关的冲突版本,如下面的版本
bundler (2.0.2, 2.0.1, default: 1.17.2)
卸载捆绑器gem
gem uninstall bundler
安装捆绑器的新副本gem
gem install bundler
现在再次尝试 运行 捆绑安装命令
bundle install
就这些了
希望对您有所帮助。
只需执行以下操作
- 打开终端
- 运行 gem uninstall bundler 卸载以前版本的 bundler
- 然后运行 gem install bundler 安装一个新的bundler
您现在可以运行
bundle install
这对我有用