【问题标题】:Why do I have to install Rails every time I open a new terminal?为什么每次打开新终端都必须安装 Rails?
【发布时间】:2023-03-05 02:23:01
【问题描述】:

我在使用 Ruby On Rails 时遇到问题。每次我打开一个新终端并输入 Rails 命令时,我都会收到此错误:

rails --version
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:

command-not-found version: 0.3
Python version: 3.2.3 final 0
Distributor ID: Ubuntu
Description:    Ubuntu 12.10
Release:    12.10
Codename:   quantal
Exception information:

unsupported locale setting
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/CommandNotFound/util.py", line 24, in crash_guard
    callback()
  File "/usr/lib/command-not-found", line 69, in main
    enable_i18n()
  File "/usr/lib/command-not-found", line 40, in enable_i18n
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python3.2/locale.py", line 541, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

我可以避免这个问题的唯一方法是重新安装 Ruby 和 Rails,我有点厌倦了,因为每次打开新终端时都必须这样做。

我尝试使用此命令进行完全卸载:

rvm implode

但没有成功。

我也尝试了这些命令,但仍然没有成功:

rvm --default use 1.9.2 (or whatever you want your default ruby interpreter to be)
rvm gemset create rails-3.0.3
rvm use 1.9.2@rails-3.0.3 --default
gem install rails

【问题讨论】:

  • 将rvm info 的输出附加到您的问题中。
  • 你是如何安装导轨的?
  • 你似乎遇到了量子问题

标签: ruby-on-rails ruby ubuntu rubygems terminal


【解决方案1】:

您似乎正在尝试使用 rvm - 检查安装文档并确保将代码添加到您的 shell 启动过程中,以便在您启动新 shell 时设置 RVM。

https://rvm.io/rvm/install/

查找“2. 将 RVM 作为函数加载到您的 shell 会话中”

【讨论】:

    【解决方案2】:

    当我在我的 Ubuntu 机器上安装 rails 时,我使用了这个分步指南。 http://coding.smashingmagazine.com/2011/06/21/set-up-an-ubuntu-local-development-machine-for-ruby-on-rails/

    我无法想象是什么导致了您的问题,但我自己也遇到了一些问题,因为一些依赖项带有错误的版本。进行完整更新可能会有所帮助。

    【讨论】:

      【解决方案3】:

      您可能只需要将 RVM 添加到 PATH 即可编写脚本。

      将以下行添加到您的 ~/.bashrc 文件中。

      PATH=$PATH:$HOME/bin/sublime_text/:$HOME/bin/cad_cuda/:$HOME/.rvm/bin
      [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-09-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-13
        • 1970-01-01
        • 2021-08-02
        • 1970-01-01
        相关资源
        最近更新 更多