rbenv: ruby: 命令未找到 [英] rbenv: ruby: command not found
问题描述
我在本地目录上使用 rbenv 和 ruby 版本 1.9.1-p378.
I am using rbenv with ruby version 1.9.1-p378 on the local dir.
命令 ruby -v 给出以下错误:
Command ruby -v gives the following error:
rbenv: ruby: command not found
The `ruby' command exists in these Ruby versions:
2.0.0-p353
知道为什么会这样吗?bundle、rails 命令也不起作用.
Any clue why this happens? The bundle, rails commands do not work either.
命令rbenv 版本:
* 1.9.1-p378 (set by /home/user/Desktop/r1/noko1/.ruby-version)
2.0.0-p353
推荐答案
您收到的投诉来自rbenv.它抱怨的事实表明 rbenv 已设置并正常工作.
The complaint you get comes from rbenv. The fact that it's complaining shows that rbenv is set up and working.
找出运行该项目所需的 Ruby 版本.项目的根目录中带有 .ruby-version 文件,或者项目中的某个人知道并推荐使用该版本.
Figure out what version of Ruby is needed to run the project. Either the project comes with a .ruby-version file in the root, or someone on the project will know and recommend that version to use.
如果 .ruby-version 文件中未指定版本,请在项目目录中创建 .ruby-version 文件.
If the version is not specified in a .ruby-version file, create the .ruby-version file in the project directory.
在该目录中输入 ruby -v
.可以吗?然后您安装了与您的 .ruby-version 要求相匹配的 Ruby 版本.
type ruby -v
while in that directory. Is it OK? Then you have the version of Ruby installed that matches what your .ruby-version is asking for.
如果最后一个命令不正确,则输入 rbenv install
.
If the last command was not OK, then type rbenv install
.
既然已经安装了 Ruby,您需要运行您的程序.我假设它带有一个 Rakefile.
Now that Ruby is installed, you need to run your program. I'm assuming it comes with a Rakefile.
安装打包工具:
gem install bundler
.
安装项目的依赖:bundle install
使用它指定的库的确切版本运行您的项目:bundle exec rails server
run your project using the exact versions of libraries it specifies: bundle exec rails server
这篇关于rbenv: ruby: 命令未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!