简体   繁体   English

使用错误的ruby版本运行的bundle命令

[英]bundle command running with wrong ruby version

I have installed 2 ruby versions on my using rbenv mac - 2.3.7 and 2.4.5 我已经使用rbenv mac在Mac上安装了2个ruby版本-2.3.7和2.4.5

If i run command ruby -v following is the output: 如果我运行命令ruby -v则输出如下:

ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-darwin18]

But if i run bundle install from my project, i get following error message: 但是,如果我从项目中运行bundle install ,则会收到以下错误消息:

Your Ruby version is 2.3.7, but your Gemfile specified 2.4.5

I have used rbenv to install different ruby version. 我已经使用rbenv安装了不同的ruby版本。

Try to add a .ruby-version file on your project's root: 尝试在项目的根目录上添加.ruby-version文件:

$ echo 'ruby-2.4.5' > .ruby-version
$ cd .

That will set your Ruby version properly. 这样可以正确设置您的Ruby版本。

You're probably running a version of Bundler that was install using a different Ruby version. 您可能正在运行使用其他Ruby版本安装的Bundler版本。 You can try reinstalling Bundler in your project folder: 您可以尝试在项目文件夹中重新安装Bundler

gem install bundler

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM