2012-09-21 25 views
1

使用rbenv因此,創建一個新的應用程序的過程是一個有點令人費解:如何在Rails中只生成Gemfile?

  1. 創建目錄
  2. 光盤目錄
  3. 套裝紅寶石版本:rbenv local 1.9.3-p125(或其他版本)
  4. 套裝寶石:echo project-name > .rbenv-gemsets
  5. gem install rails -v 3.2.2 --no-rdoc --no-ri(例如)
  6. rbenv rehash
  7. echo "gem 'rails', '3.2.2'" > Gemfile
  8. bundle
  9. rails new .(輸入y覆蓋)
  10. bundle

此工作過,但這次我上了rails new .命令是錯誤的:

... 
... 
create vendor/assets/stylesheets 
create vendor/assets/stylesheets/.gitkeep 
create vendor/plugins 
create vendor/plugins/.gitkeep 
run bundle install 
b/gems/bundler-1.2.1/lib/bundler/resolver.rb:287:in `resolve': Could not find gem 'jquery-rails (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound) 

運行rails new .第二次投擲

Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.

什麼是初始化一個新的Rails應用程序,如果它不可能做rails new app-name的最佳方式?

如何創建Gemfile?如果我有正確的Rails的Gemfile,然後bundlerails new .應該工作...

+0

這個問題似乎是安裝jquery-rails。你是否嘗試再次運行包? – nathanvda

回答

0

你跑rails new而且大多succeded(與最終bundle命令除外),這是沒有必要生成Rails應用程序後再次。

你似乎已經做好了一切。您唯一的問題是無法安裝單個寶石。您應該再次嘗試運行bundle install,如果仍然無法運行,請檢查您在Gemfile中是否有source 'https://rubygems.org',並且可能要刪除rm -r .bundle以刪除任何本地Bundler設置。