Ubuntu 10 Ruby 1.9 Rails 3:没有这样的文件或目录 [英] Ubuntu 10 Ruby 1.9 Rails 3: No such file or directory

查看:28
本文介绍了Ubuntu 10 Ruby 1.9 Rails 3:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为此苦苦挣扎了一段时间.我在装有 ruby​​ 1.8 的开发机器上运行 Ubuntu 10,我删除了.我使用RVM和本教程http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

I have been struggling with this for quite some time now. I'm running Ubuntu 10 on the dev machine which had ruby 1.8 on it, which I removed. I installed Ruby 1.9.3 and rails3 using RVM and this tutorial http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

当我输入 ruby -v 我得到

ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]

这似乎是正确的.

我使用

rails new mysite

成功创建了新应用.然后我

which created the new app successfully. then I

cd mysite

并创建了一个宝石组

rvm gemset create 'rails3'

然后我在/mysite/文件夹中使用了这个

then I used this inside the /mysite/ folder

rvm use 1.9.3@rails3 --rvmr
Using /usr/local/rvm/gems/ruby-1.9.3-p125 with gemset rails3

但是当我尝试运行它时出现问题

root@server-pc:/var/www/mysite# rails s
-bash: /usr/bin/rails: /usr/bin/ruby1.8: bad interpreter: No such file or directory

编辑 1:

root@server-pc:/var/www/mysite# which ruby
/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby

推荐答案

root用户

log in as root user

列出红宝石包

list ruby packeges

dpkg -l | grep ruby

然后删除所有 ruby​​ 包

then remove all ruby packeges

aptitude purge <package name>

如果你安装了rvm

rvm remove all

然后

rvm implode

rvmsudo rvm implode

<小时>

安装红宝石

仍以 root

安装所有必要的工具和库

install all of the necessary tools and libraries

apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev

安装 rvm

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

然后添加这一行作为 .bashrc 中的最后一行:

Then add this line as the last line in your .bashrc:

nano ~/.bash_profile

if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi

测试 RVM 安装

rvm notes

接下来,您可以通过运行开始 ruby​​ 1.9.2 安装

Next, you can begin ruby 1.9.2 installation by running

rvm install 1.9.2

安装最多需要几分钟,一旦完成,您必须将 ruby​​ 1.9.2 设置为默认版本

The install will take up to several minutes and once it completes you have to set ruby 1.9.2 as the default version

rvm --default ruby-1.9.2

测试你的新 ruby​​ 安装ruby -v

test your new ruby install ruby -v

安装 Rails 3

gem install rails

如果您想使用 sqlite 快速启动并运行数据库,则需要 sqlite3 和 libsqlite3-dev 软件包

If you want to get a quick database up and running with sqlite, then you’ll need to sqlite3 and the libsqlite3-dev packages

apt-get install sqlite3 libsqlite3-dev

gem install sqlite3-ruby

创建新应用

rails new testapp

cd testapp

确保您在测试应用程序目录中并运行

Make sure you are in your test app directory and run

rails s

打开浏览器http://localhost:3000

这篇关于Ubuntu 10 Ruby 1.9 Rails 3:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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