错误与"宝石列表"," rails -v"

时间:2017-11-07 14:07:48

标签: ruby-on-rails ruby rubygems

在macOS High Sierra(10.13),' gem list'返回以下错误:

gem list
/Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:93:in `pwd': No such file or directory - getcwd (Errno::ENOENT)
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:93:in `lockfile_contents'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:81:in `lockfile_version'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:29:in `bundler_version_with_reason'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:12:in `bundler_version'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:46:in `compatible?'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1059:in `block in find_by_path'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1058:in `each'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1058:in `find'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1058:in `find_by_path'
    from /Library/Ruby/Site/2.3.0/rubygems.rb:215:in `try_activate'
    from /Library/Ruby/Site/2.3.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Library/Ruby/Site/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from :6:in `'

当前的Ruby版本:

$ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]

当前的Rails版本:

$rails -v
/Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:93:in `pwd': No such file or directory - getcwd (Errno::ENOENT)
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:93:in `lockfile_contents'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:81:in `lockfile_version'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:29:in `bundler_version_with_reason'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:12:in `bundler_version'
    from /Library/Ruby/Site/2.3.0/rubygems/bundler_version_finder.rb:46:in `compatible?'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1059:in `block in find_by_path'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1058:in `each'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1058:in `find'
    from /Library/Ruby/Site/2.3.0/rubygems/specification.rb:1058:in `find_by_path'
    from /Library/Ruby/Site/2.3.0/rubygems.rb:215:in `try_activate'
    from /Library/Ruby/Site/2.3.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Library/Ruby/Site/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from :6:in `'

1 个答案:

答案 0 :(得分:0)

请使用此:

gem uninstall rails

gem install rails -v 4.2