我是Ruby和RoR的新手,按照RoR指南的第一步,我遇到了问题。正如他们所说in the docs,我试图安装RoR并创建一个新项目。
首先,运行gem install rails
,在我看来这是宝石railties
的一个问题。我又跑了gem install rails
,一切似乎都很好。
但是,当我尝试生成运行rails new my_project
的项目时,run bundle install
内部命令中出现错误:
...blablabla
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.0/lib/rails/g
enerators/app_base.rb:331:in ``': No such file or directory - ""C:/Program Files
/Ruby200-x64/bin/ruby.exe"" "C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/ge
ms/bundler-1.6.2/bin/bundle" install (Errno::ENOENT)
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.
0/lib/rails/generators/app_base.rb:331:in `block in bundle_command'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.2
/lib/bundler.rb:235:in `block in with_clean_env'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.2
/lib/bundler.rb:222:in `with_original_env'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.2
/lib/bundler.rb:228:in `with_clean_env'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.
0/lib/rails/generators/app_base.rb:330:in `bundle_command'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.
0/lib/rails/generators/app_base.rb:345:in `run_bundle'
from (eval):1:in `run_bundle'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/command.rb:27:in `run'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/invocation.rb:126:in `invoke_command'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/invocation.rb:133:in `block in invoke_all'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/invocation.rb:133:in `each'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/invocation.rb:133:in `map'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/invocation.rb:133:in `invoke_all'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/group.rb:232:in `dispatch'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/thor-0.19.1/l
ib/thor/base.rb:440:in `start'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.
0/lib/rails/commands/application.rb:17:in `<top (required)>'
from C:/Program Files/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kerne
l_require.rb:53:in `require'
from C:/Program Files/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kerne
l_require.rb:53:in `require'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.
0/lib/rails/cli.rb:14:in `<top (required)>'
from C:/Program Files/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kerne
l_require.rb:53:in `require'
from C:/Program Files/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kerne
l_require.rb:53:in `require'
from C:/Program Files/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.
0/bin/rails:9:in `<top (required)>'
from C:/Program Files/Ruby200-x64/bin/rails:23:in `load'
from C:/Program Files/Ruby200-x64/bin/rails:23:in `<main>'
我已经删除了rails
和railties
宝石并重新安装了它们,但没有任何变化。有什么想法吗?
版本:
ruby -v
ruby 2.0.0p353(2013-11-22)[x64-mingw32]
rails -v
Rails 4.1.0
我正在 Windows 7(x64)
上运行答案 0 :(得分:0)
我找到了一个简单的解决方案。我安装了Ruby 1.9.3,现在一切正常:
ruby -v
ruby 1.9.3p545(2014-02-24)[i386-mingw32]
答案 1 :(得分:0)
尝试在其默认目录C:\ Ruby200或C:\ Ruby200-x64下安装Ruby。
答案 2 :(得分:-3)
首先使用命令
rails new yourProjectName
然后运行命令
rails s
创建服务器