我遇到了启动并运行新rails项目的问题。自从我创建了一个新项目以来已经有一段时间了,但是我一直在研究各种与工作相关的项目,这些项目有很多不同的rails / ruby版本(都很好)。也就是说,我只是尝试创建一个新项目,当我运行rails -v
或rails new xxxx
时,我得到了:
/Users/trevor/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- /Users/trevor/Desktop/config/boot (LoadError)
from /Users/trevor/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from script/rails:5:in `<main>'
具体细节信息
ruby -v =&gt; ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
*使用RVM
哪个ruby =&gt; /Users/trevor/.rvm/rubies/ruby-2.2.2/bin/ruby
gem list =&gt; 显示所有必要的宝石(即铁轨,捆绑等)
rvm info =&gt;
ruby-2.2.2:
system:
uname: "Darwin Trevor.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)"
zsh: "/usr/local/bin/zsh => zsh 5.0.8 (x86_64-apple-darwin14.3.0)"
rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "2 months 7 days 5 hours 33 minutes 19 seconds ago"
path: "/Users/trevor/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.2p95"
date: "2015-04-13"
platform: "x86_64-darwin14"
patchlevel: "2015-04-13 revision 50295"
full_version: "ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]"
homes:
gem: "/Users/trevor/.rvm/gems/ruby-2.2.2"
ruby: "/Users/trevor/.rvm/rubies/ruby-2.2.2"
binaries:
ruby: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/ruby"
irb: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/irb"
gem: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/gem"
rake: "/Users/trevor/.rvm/rubies/ruby-2.2.2/bin/rake"
environment:
PATH: "/Users/trevor/.rvm/gems/ruby-2.2.2/bin:/Users/trevor/.rvm/gems/ruby-2.2.2@global/bin:/Users/trevor/.rvm/rubies/ruby-2.2.2/bin:/Users/trevor/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:bin:/Users/trevor/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin"
GEM_HOME: "/Users/trevor/.rvm/gems/ruby-2.2.2"
GEM_PATH: "/Users/trevor/.rvm/gems/ruby-2.2.2:/Users/trevor/.rvm/gems/ruby-2.2.2@global"
MY_RUBY_HOME: "/Users/trevor/.rvm/rubies/ruby-2.2.2"
IRBRC: "/Users/trevor/.rvm/rubies/ruby-2.2.2/.irbrc"
RUBYOPT: ""
gemset: ""
我尝试过的事情
rvm gemset empty
,清空当前的default
gemset gem install rails
2.2.2
切换到一个不同的gemset,rails new
在该配置中也不起作用。 require': cannot load such file -- /Users/trevor/Desktop/config/boot (LoadError)
为什么rails会在桌面/配置上查找启动文件?rvm implode
,重新安装了rvm,结果相同。但是,我注意到通过更改目录,我可以创建新项目。出于某种原因,错误与尝试在Users/trevor/Desktop
中创建项目有关。答案 0 :(得分:2)
想出来,但想发布以防其他人在同一条船上。在我意识到rails new
可以在其他目录中工作之后,显然在桌面上创建项目时会发生一些事情。
从底线开始,确保在运行名为script
的rails命令的目录中没有文件/目录。可能还有其他文件/目录名称也可能导致冲突。