简体   繁体   English

在Ubuntu 10.04中安装Rails期间出错

[英]Error during Installing Rails in Ubuntu 10.04

First I installed rvm for multi-user using script 首先,我使用脚本为多用户安装了rvm

 \curl -L https://get.rvm.io | sudo bash -s stable

and I added users to rvm group. 并将用户添加到rvm组。

and rvm seems worked fine. 和rvm似乎工作正常。 so I installed ruby 1.9.3 and set 1.9.3 as default 所以我安装了ruby 1.9.3并将1.9.3设置为默认值

and now I tried to install rails with command 现在我试图用命令安装rails

 gem install rails 

It seems worked fine, but when fetching json-1.7.6.gem and an error occurs. 似乎工作正常,但是在获取json-1.7.6.gem时发生错误。

 ERROR:  Error installing rails:
 ERROR: Failed to build gem native extension.

 /usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
 creating Makefile

 make
 sh: make: Permission denied


 Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6 for inspection.
 Results logged to /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

So I thought it would be related with permission, so I tried 所以我认为这与许可有关,所以我尝试了

 sudo gem install rails

but then this error occurs. 但随后会发生此错误。

 sudo: gem: command not found

What should I do? 我该怎么办?

use sudo as follows.. 使用sudo如下。

sudo gem install rails 

Updated Answer: 更新的答案:

our $PATH variable needs to include the exact path to your Ruby's bin directory. 我们的$PATH变量需要包含Ruby的bin目录的确切路径。 Adding a directory to the PATH does not include it's subfolders. 将目录添加到PATH不包含其子文件夹。 Try adding the bin directory via: 尝试通过以下方式添加bin目录:

export PATH=$PATH:/home/adam/.gem/ruby/1.8/bin

or if you installed the gem using sudo: 或者如果您使用sudo安装了gem:

export PATH=$PATH:/usr/lib/ruby/gems/1.8/bin

You might want to add this to your .bashrc file, so that you don't have to set this manually every time your open up a new bash. 您可能希望将此添加到您的.bashrc文件中,这样就不必在每次打开新bash时都进行手动设置。

you can use rvmsudo to run sudo commands. 您可以使用rvmsudo运行sudo命令。 But you should really be using Gemfiles to install gems using Bundler . 但是您应该真正使用Gemfiles通过Bundler安装gem。

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

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