gpt4 book ai didi

ruby-on-rails - RVM,Rails LoadError

转载 作者:数据小太阳 更新时间:2023-10-29 09:02:21 26 4
gpt4 key购买 nike

我在启动和运行新的 Rails 项目时遇到了问题。自从我创建一个新项目以来已经有一段时间了,但是我一直在使用许多不同的 rails/ruby 版本(都很好)从事各种与工作相关的项目。也就是说,我只是尝试创建一个新项目,当我为此运行 rails -vrails 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 => ruby 2.2.2p95(2015-04-13 修订版 50295)[x86_64-darwin14] * 使用 RVM哪个 ruby => /Users/trevor/.rvm/rubies/ruby-2.2.2/bin/ruby
gem list => 显示所有必要的 gem(即 rails、bundler 等)
rvm 信息 =>

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 安装 rails
  • 通常我每个项目都有不同的 gemset,我切换到一个使用 2.2.2 的不同 gemset,rails new 在该配置中也不起作用。
  • 错误中的这一行对我来说似乎很奇怪:require': cannot load such file --/Users/trevor/Desktop/config/boot (LoadError) Why would rails be looking on the desktop/config 用于引导文件?
  • 预制 rvm implode,重新安装 rvm,结果相同。但是,我确实注意到通过更改目录我能够创建新项目。由于某种原因,该错误与在 Users/trevor/Desktop 中尝试创建项目有关。

最佳答案

想通了,但想发帖以防其他人在同一条船上。在我意识到 rails new 可以在其他目录中工作后,显然在桌面上创建项目时发生了一些事情。

最重要的是,确保在运行名为 script 的 rails 命令的目录中没有文件/目录。可能还有其他文件/目录名称也可能导致冲突。

关于ruby-on-rails - RVM,Rails LoadError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32340414/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com