简体   繁体   English

Rails仅在特定终端中工作

[英]Rails working in specific terminal only

I have installed rails in ubuntu its working fine in the terminal which i installed, once i close the terminal and open it again and when i check for rails -v am getting following error. 我已经在ubuntu中安装了rails,在我安装的终端中工作正常,一旦我关闭终端并再次打开它,当我检查rails -v时出现以下错误。 Again i tried installing it but no luck same thing repeated again. 再次,我尝试安装它,但没有运气再重复一次。

This is the installation link i followed 这是我关注的安装链接

The program 'rails' can be found in the following packages:
 * rails
 * ruby-railties-3.2
Try: sudo apt-get install <selected package>

checked for ruby -v 检查ruby -v

The program 'ruby' can be found in the following packages:
 * ruby1.8
 * ruby1.9.1
Try: apt-get install <selected package>

and also for gem list rails 以及gem list rails

The program 'gem' can be found in the following packages:
 * ruby1.9.1
 * rubygems
Try: apt-get install <selected package>

The problem is rails (and gem) are not in your PATH after you restart your terminal session but since your system sees them as packages in the repositories, it suggests you install those packages. 问题是重新启动终端会话后,rails(和gem)不在您的PATH中,但是由于系统将它们视为存储库中的软件包,因此建议您安装这些软件包。 Using the repository packages is generally a bad idea with Rails because those packages are out-of-date. 对于Rails,使用存储库软件包通常不是一个好主意,因为这些软件包已过时。

Follow the instructions in this answer to install Ruby and then install rails using 按照此答案中的说明安装Ruby,然后使用

gem install rails

Remember to install RVM as a regular user, not as root. 记住要以普通用户而不是root用户身份安装RVM。

Edit: Based on your comments, the most likely reason why you're losing rails is because you installed RVM as the root user but you are a regular user after you restart the terminal. 编辑:根据您的评论,最有可能丢失rails的原因是因为您以root用户身份安装了RVM,但是重新启动终端后却是常规用户。

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

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