简体   繁体   English

无法访问Ubuntu 14.04上的Rails控制台

[英]Can not access rails console on ubuntu 14.04

I am trying to access the console to manage my application and it wont let me. 我试图访问控制台来管理我的应用程序,但它不允许我这样做。 what i right is rails console or rails c and i get this: 我正确的是Rails console或rails c,我得到了:

agustin@agustin:~/Agustin/RoRProyect$ rails c
/usr/lib/ruby/vendor_ruby/active_support/test_case.rb:12:in `<module:ActiveSupport>': uninitialized constant Test (NameError)
    from /usr/lib/ruby/vendor_ruby/active_support/test_case.rb:11:in `<top (required)>'
    from /usr/lib/ruby/vendor_ruby/rails/console/app.rb:2:in `<top (required)>'
    from /usr/lib/ruby/vendor_ruby/rails/application.rb:312:in `initialize_console'
    from /usr/lib/ruby/vendor_ruby/rails/application.rb:152:in `load_console'
    from /usr/lib/ruby/vendor_ruby/rails/commands/console.rb:27:in `start'
    from /usr/lib/ruby/vendor_ruby/rails/commands/console.rb:8:in `start'
    from /usr/lib/ruby/vendor_ruby/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

also, after some time or when i close terminal, my server keeps running but i cant log to my localhost:port and i cant cancell it so i have to restart the computer every time i close that, how can i close it? 另外,过了一段时间或关闭终端后,我的服务器仍在运行,但是我无法登录到localhost:port,因此无法取消它,因此每次关闭时我都必须重新启动计算机,如何关闭它?

Thanks im noob new to ubuntu and ruby so i appreaciate any help! 感谢im noob对ubuntu和ruby的了解,所以我感谢您的帮助!

It's a bug and described here . 这是一个错误,请在此处进行说明

Run these following commands : 运行以下命令:

sudo apt-get install ruby-test-unit
sudo echo require 'test/unit' >> /usr/lib/ruby/vendor_ruby/active_support/test_case.rb

And I think using RVM or RBENV is a popular practice amongst the Ruby Community to install and maintain ruby versions. 而且我认为使用RVMRBENV是Ruby社区中安装和维护ruby版本的流行做法。

Install Ruby using RVM : 使用RVM安装Ruby

Make sure you have logged in using shell: 确保您已使用Shell登录:

Terminal > Edit > Profile Preferences > Title and Command > Check Run command as a login shell 终端>编辑>配置文件首选项>标题和命令>选中运行命令作为登录外壳

Install depencies: 安装依赖关系:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties

Install RVM and Ruby 2.1.5 安装RVMRuby 2.1.5

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.5
rvm use 2.1.5 --default
ruby -v

To exclude documentation for each package: 要排除每个软件包的文档:

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

Before installing rails you can install node which will come along the v8 JS engine: 在安装rails之前,您可以安装v8 JS引擎附带的节点:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Finally rails (optional) : 最后的导轨(可选)

gem install rails

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

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