2012-03-11 22 views
1

這是一個非常奇怪的,我不知道如何繼續。Rails應用程序不能檢測本地寶石

基本上,我能夠安裝寶石,並通常在除了用rails創建的文件夾之外的任何文件夾中使用它們。這非常奇怪。這很難解釋,所以也許這個控制檯輸出可以解釋

[email protected]:~/railsapps$ ls 
    app test_application testing 
    [email protected]:~/railsapps$ rails -v 
    Rails 3.2.2 
    [email protected]:~/railsapps$ 
    [email protected]:~/railsapps$ 
    [email protected]:~/railsapps$ cd app/ 
    [email protected]:~/railsapps/app$ ls -a 
    . app  config.ru doc  Gemfile.lock lib public README.rdoc test vendor 
    .. config db   Gemfile .gitignore log Rakefile script  tmp 
    [email protected]:~/railsapps/app$ 
    [email protected]:~/railsapps/app$ 
    [email protected]:~/railsapps/app$ rails -v 
    The program 'rails' is currently not installed. To run 'rails' please ask your administrator to install the package 'rails' 
    [email protected]:~/railsapps/app$ 

它使雞毛蒜皮的所有感覺。當我的rails文件夾外,我可以調用rails來創建一個新的應用程序,但是一旦進入,rails就不會被檢測到。這對包括捆綁軟件在內的所有寶石都是一樣的。

我的第一個想法是,不知何故,rails有一些特定的gem文件夾隱藏起來,所以我從rails項目中完成了我的gem install,但是這也不起作用。

有什麼想法?


我的設置是Ubuntu服務器10.10(我知道,我知道) 紅寶石1.9.2 寶石1.8.17 和我使用從wayneeseguin最新RVM。 enter code here

+0

您的應用程序中是否有.rvmrc文件夾? – 2012-03-11 21:58:59

+0

@FrederickCheung沒有。我已經將輸出更改爲ls-a,所以你可以看到完整的目錄 – OVERTONE 2012-03-11 22:02:40

+0

啊,我不知道你必須指定在rails文件夾中使用哪個rvm gemset'rvm use ruby​​-1.9.2-pxxxxx' – OVERTONE 2012-03-11 22:07:30

回答

0

這種類型的問題發生了一些時間,我覺得你可以通過installing and using RVM

節省了大量的時間來安裝RVM創建目錄寶石每次只要創建單獨的項目時間之後。例如,你創建應用程序博客首先創建目錄寶石與給這個命令

rvm gemset create blog 

,那麼你應該使用這個目錄寶石和紅寶石也版本,以及如你有安裝Ruby 1.9.2,然後使用這個命令

rvm use [email protected] 

後進入博客應用程序的目錄,並安裝此寶石

gem install bundler 

也然後bundle install。因此所有本地gem都將被安裝到rvm下的這個博客目錄中,並且不會出現任何衝突。但請記住,如果您的平臺是ubuntu,那麼這將工作

+0

我只是讓你的回答更像一個文本牆。我希望你不介意。 – 2012-03-26 07:44:53

相關問題