使用rbenv所以创建新应用程序的过程有点复杂:
rbenv local 1.9.3-p125
(或其他版本)echo project-name > .rbenv-gemsets
gem install rails -v 3.2.2 --no-rdoc --no-ri
(例如)rbenv rehash
echo "gem 'rails', '3.2.2'" > Gemfile
bundle
rails new .
(输入y覆盖)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 new app-name
,则初始化新Rails应用的最佳方法是什么?
如何只创建Gemfile?如果我有正确的Rails Gemfile,那么bundle
和rails new .
应该有用......
答案 0 :(得分:0)
运行rails new
并且它大部分成功后(最终的bundle
命令除外),没有必要再次生成Rails应用程序。
你好像做得对。您唯一的问题是无法安装单个gem。您应该再次尝试运行bundle install
,如果仍然无效,请检查Gemfile中是否有source 'https://rubygems.org'
,可能rm -r .bundle
删除任何本地Bundler设置。