zoukankan      html  css  js  c++  java
  • 安装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.

  • 相关阅读:
    layui table表格 表头与内容列错位问题(只有纵向滚动条的情况)
    layui table+复杂表头+合并单元格
    echarts 柱状图
    1-jdk的安装与配置
    变量的解构赋值(对象)
    变量的解构赋值(数组)
    git常用命令
    markdown常用语法
    微信小程序全局/页面配置
    git使用简介(二)
  • 原文地址:https://www.cnblogs.com/chenzhenzhen/p/3872063.html
Copyright © 2011-2022 走看看