我正在尝试打开 Rails 控制台并获取
deployer@microv:~$ rails console
-bash: rails: command not found
我的环境 ubuntu 12.10 postgresql rbenv-installer unicorn
我正在尝试打开 Rails 控制台并获取
deployer@microv:~$ rails console
-bash: rails: command not found
我的环境 ubuntu 12.10 postgresql rbenv-installer unicorn
由于您几乎没有提供有关您的环境以及您在何处以及如何使用 Rails 的信息,因此有一些提示:
$ cd path/to/rails/app
$ rails console
rails console
仅适用于构建您的 rails 应用程序的目录。你有一个,不是吗?
$ cd path/to/rails/app
$ bundle exec rails console
使用 bundler 时,安装在该 bundle 中的 gem 的二进制文件只能通过 command 获得bundle exec
。您可能已经使用 bundler 安装了 rails 本身。你是否?
$ cd path/to/rails/app
$ rvm list gemsets
$ rvm use ruby-1.x.y@foo
$ rails console
使用 rvm 时,rails 只能安装在一个 Gemset 中。然后,您必须激活该 gemset 才能访问宝石(及其垃圾箱)。你在使用 RVM 吗?
You seem to be using rbenv. When installing/removing gems bundled with executables, like rails
and many others, you have to do rbenv rehash
.
找到解决办法,重启shell
$ exec $SHELL -l