在运行 Ubuntu 11.10 的 VM 上使用 rails,但关机后显示“未安装 rails"; [英] Used rails on VM running Ubuntu 11.10 but after shutdown says "rails is not installed"

查看:24
本文介绍了在运行 Ubuntu 11.10 的 VM 上使用 rails,但关机后显示“未安装 rails";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我在这里搜索了许多相关的问题并尝试了几种解决方案,但我没有任何运气.前言:我对 Ubuntu 和 Ruby 非常陌生,尽管我有很多 C++ 经验.我在 Windows 7 中运行虚拟机以使用 Ubuntu 11.10.我正在以家庭承包商的身份从事一个更大的项目,并且我正在使用 RVM.经过几天的项目工作,我决定关闭 Ubuntu 而不是挂起它的虚拟机.现在,当我使用rails s"(它整个星期都很好地启动了我的服务器)时,它说

First, I have searched many questions on here that are related and tried several solutions, but I am not having any luck. Preface: I am VERY new to Ubuntu and Ruby, though I have much C++ experience. I am running a virtual machine in Windows 7 to use Ubuntu 11.10. I am working on a larger project as a home contractor, and I AM using RVM. After several days of working on the project fine, I decided to shut down Ubuntu instead of just suspend its virtual machine. Now, when I use "rails s" (which started my server fine all week) it says

The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

我真的很犹豫要不要使用 sudo apt-get 因为我在这里读到的其他答案.我想我需要向 .bashrc 添加一些东西,但到目前为止我还没有任何运气.非常感谢!

I am really hesitant to use sudo apt-get because of other answers I have read on here. I think I need to add something to .bashrc but so far I haven't had any luck. Thank you very much!

更新事实证明 .rvmrc 已被其他人从 repo 中删除,并且在我重新启动之前这显然无关紧要,所以我最终要做的是 rvm use 1.9.2 --default(将 RVM 更改回我的正确版本) 然后,在我的项目根文件夹中, rvm --create --rvmrc 1.9.2@myprojectnamehere 后跟另一个包安装.不知道这是否对其他人有帮助,但我希望如此

UPDATE It turns out the .rvmrc was removed from the repo by someone else and it didn't apparently matter until I rebooted, so what I ultimately had to do was rvm use 1.9.2 --default (to change RVM back to my correct version) and then, in my project root folder, rvm --create --rvmrc 1.9.2@myprojectnamehere followed by another bundle install. No idea if this will help someone else but I hope so

推荐答案

我已经在两个 Ubuntu 11.10 机器上安装了 rails 3.1.如下安装rvm(以root身份)

I've put rails 3.1 on two Ubuntu 11.10 boxes. Install rvm as follows (as root)

  bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

再次以root身份安装rvm后,在rvm中安装ruby 1.9.3,将默认的rvm改为1.9.3.(rvm 使用 --default 1.9.3).现在确保 rvm 脚本已加载到/etc/profile.d可能需要在用户的 .bashrc 文件中获取/etc/profile 的来源.

After rvm is installed as root again, install ruby 1.9.3 in the rvm, change the default rvm to 1.9.3. (rvm use --default 1.9.3). Now make sure the rvm scripts are loaded into /etc/profile.d it may be necessary to source /etc/profile in your users' .bashrc file.

在此之后,只需调用 gem install rails 等就足够了.

After this simply calling gem install rails etc will suffice.

不要将 aptitude 用于 ruby​​ 或 rails.

Do not use aptitude for ruby or rails.

这篇关于在运行 Ubuntu 11.10 的 VM 上使用 rails,但关机后显示“未安装 rails";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆