• 安装rails旧版本出错bin_path': can't find gem railties (["3.0.5"]) with executable rails (Gem::GemNotFoundException)


    $ rails _3.0.5_ new depot
    rubygems.rb:244:in `bin_path': can't find gem railties (["3.0.5"]) with executable rails (Gem::GemNotFoundException)
    出错
    重装了rails sudo gem install rails --version 3.0.5后
    $ rails _3.0.5_ new depot
    dependency.rb:247:in `to_specs': Could not find rails (= 3.0.5) amongst [bundler-1.6.2, bundler-unload-1.0.2, executable-hooks-1.3.1, gem-wrappers-1.2.4, i18n-0.6.9, json-1.8.1, minitest-5.3.3, minitest-1.6.0, rake-0.8.7, rdoc-4.1.1, rdoc-2.5.8, rubygems-bundler-1.4.3, rvm-1.11.3.9, thread_safe-0.3.3, tzinfo-1.1.0] (Gem::LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
    from /usr/local/bin/rails:22:in `<main>'
    运行命令rvmsudo gem install rails --version 3.0.5之后
    Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:

    export rvmsudo_secure_path=1

    to avoid the warning, put it in shell initialization file to make it persistent.

    In case there is no `secure_path` in `/etc/sudoers`. Run:

    export rvmsudo_secure_path=0

    to avoid the warning, put it in shell initialization file to make it persistent.
    rails's executable "rails" conflicts with railties
    Overwrite the executable? [yN] y
    Successfully installed rails-3.0.5
    Parsing documentation for rails-3.0.5
    Done installing documentation for rails after 0 seconds
    1 gem installed

    如果不行,bundle install, 再运行一次rvmsudo gem install rails --version 3.0.5
    原理:
    安装时路径出现了问题
    I try to explain this a bit because of the upvotes:
    This basically is a path issue. If you set up gems via gem install, they mostly likely will be in another directory (e.g. /usr/local/) compared to gems set up via bundler (where you can override it with --path). Using sudo may also set them up into another directory since sudo starts a subshell which has a different environment then. This is why you have rvmsudo.

    If you want to see the differences, compare $PATH, $GEM_HOME, $GEM_PATH and $BUNDLE_PATH when echoing directly, with sudo and with rvmsudo.

  • 相关阅读:
    Movement Type
    Excel制表技巧
    [转]MM移动类型的配置相关的系统表,举例说明SAP是如何根据配置抛帐的
    Microsoft Excel:Automatically color alternating rows(columns)
    eBook试载(1):Workbook对象与示例(1)
    辨析:would rather 和 prefer
    Serial Number Management In SAP SD
    <摘录>NAL格式
    linux服务简介关闭不需要的Linux服务
    <摘录>PS和TS流的区别
  • 原文地址:https://www.cnblogs.com/chenzhenzhen/p/3872063.html
Copyright © 2020-2023  润新知