当前位置: 首页 > 知识库问答 >
问题:

rails new或rails-h craps out不能加载这样的文件--io/console

方恺
2023-03-14
[ec2-user@ip-XX-XXX-XXX-XXX rails]$ rails -h
/usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError)
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/shell/basic.rb:2:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/shell/color.rb:1:in `<top (required)>'
    from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/shell.rb:17:in `shell'
    from /usr/local/share/ruby/gems/2.0/gems/thor-0.19.1/lib/thor/base.rb:439:in `start'
    from /usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/commands/application.rb:17:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/cli.rb:14:in `<top (required)>'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/bin/rails:9:in `<top (required)>'
    from /usr/local/bin/rails:23:in `load'
    from /usr/local/bin/rails:23:in `<main>'
$ which rails
/usr/local/bin/rails

$ rails -v
Rails 4.1.0
$ gem install bundler
Fetching: bundler-1.6.2.gem (100%)
Successfully installed bundler-1.6.2
Parsing documentation for bundler-1.6.2
Installing ri documentation for bundler-1.6.2
Done installing documentation for bundler after 5 seconds
1 gem installed

我检查了重复安装:

$ find / 2>/dev/null| grep bin/ruby
/usr/bin/ruby
/usr/bin/ruby2.0

$ find / 2>/dev/null| grep bin/rails
/usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/bin/rails
/usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/generators/rails/plugin/templates/bin/rails.tt
/usr/local/share/ruby/gems/2.0/gems/railties-4.1.0/lib/rails/generators/rails/app/templates/bin/rails
/usr/local/share/ruby/gems/2.0/gems/rails-4.1.0/guides/code/getting_started/bin/rails
/usr/local/bin/rails
/home/ec2-user/.gem/ruby/2.0/gems/rails-4.1.0/guides/code/getting_started/bin/rails

共有1个答案

冯翔
2023-03-14

您需要安装IO-console gem。使用以下命令安装它:

gem install io-console

运行后rails-h

此外,运行echo$path并确保路径中有/usr/local/bin。如果没有,则需要添加它。

 类似资料:
  • 我安装了新的Ruby(2.0)和Rails 4.0,当我做“Rails新test_app”时,我会得到以下信息。有人遇到这个吗? [devuser@devbox~]$railstest_app /usr/本地/库/红宝石/2.0.0/红宝石/core_ext/kernel_require.rb:45:

  • 我正在尝试运行一个jruby应用程序。每当我启动jruby脚本时,应用程序就会抛出一个错误 loaderror:没有这样的文件可加载--openssl/dummy(root)在/home/ubuntu/.rvm/gems/jruby-1.7.3/gems/jruby-0.8.2/lib/shared/jruby-openssl.rb:15 require at org/jruby/rubykern

  • 问题内容: 我安装了节点。然后我用安装了npm 。现在,当我尝试运行我得到 如何解决此错误? 问题答案: Ubuntu中有两个名称相似的软件包 node 和 nodejs 。 做这个, Description-zh:业余分组无线节点程序。节点程序接受TCP / IP和分组无线网络连接,并为用户提供一个接口,该接口允许他们使用各种业余无线协议与远程主机建立网关连接。 做这个, Description

  • 所以我检查了gradlew是否在项目目录下,但我找不到它。但我仍然可以运行任务从‘分级项目’窗口。 怎么了?

  • 问题内容: 我在Windows中使用Code :: Blocks。 我创建了一个dll项目,试图获得一些JNI实践。 在javah生成的.h文件中,有#include jni.h,但是当我尝试对其进行编译时,它总是说jni.h:没有这样的文件或目录。 我认为这与classpath有关,但我不知道它是什么!可能是我必须更改Code :: Blocks的设置 有人可以帮我解决这个问题吗?非常感谢 编辑