Почему у меня / как я могу исправить эту ошибку: "shell_session_update: команда не найдена"

16036
Pysis

Фон

Я вхожу в Ruby 2.x и Rails 4.x на MacBook с OS X El Capitan (10.11.3), используя оболочку fish, используя интеграцию, указанную на этой странице: RVM - Fish Shell (интеграция)

проблема

При выполнении различных команд, таких как rvm version, rvm install ..., rvm use ..., rvm --default ...и т.д., я получаю следующее сообщение об ошибке:

/var/folders/2w/zhgybz7d25s1gdy41qdxwp48001gfh/T/rvm.fish.Pqd0CuZRJW: shell_session_update: command not found 

Быстрый поиск в Google не возвращает никаких связанных результатов, которые могли бы помочь мне определить и / или устранить проблему, как это помогло решить многие другие мои проблемы с настройкой разработки.

Я выполнил быстрый текстовый поиск в rvm.fishфайле функций, в .config/fishкаталоге, а также в $HOME/.rvm/bin/rvmглавном исполняемом файле и не увидел команду, например shell_session_update, вызываемую непосредственно в этом файле.

Вопрос

Кто-нибудь знает, почему это происходит, и как я могу это исправить? Я - человек, который любит исправлять вещи передо мной, так что передо мной появляются только те вещи, над которыми нужно действовать, поэтому я хотел бы удалить это сообщение об ошибке / предупреждение. :)

PS Конкретная версия Ruby (2.0.0), которую я пытался установить и использовать, похоже, работает должным образом, даже в том же сеансе терминала (iTerm (2)), без необходимости его перезапуска. С тех пор я закрыл тот и создал новый сеанс терминала, и все еще вижу сообщение, появляющееся при выполнении различных вышеупомянутых команд.

23
`shell_session_update` - это функция Bash, установленная OS X в` / etc / bashrc_Apple_Terminal`, поэтому, вероятно, что-то в командах Bash, которые запускает RVM, производит ее в качестве вывода. Zanchey 8 лет назад 0
[ИСПРАВЛЕНО - команда shell_session_update не найдена] (http://www.singhajit.com/shell_session_update-command-not-found/) Ajit Singh 8 лет назад 0

2 ответа на вопрос

39
Pysis

TL;DR: Make sure RVM is up-to-date to at least 1.26.11 by re-installing or issuing the command rvm get head, and is only being initialized once per terminal environment.

Result

Eventually I was able to fix my environment. I will post some information pertaining to my specific problem in an effort to help some, even though others may have the same symptom but another root cause.

Cause

One part of the root problem was coming from RVM, and how it was being initialized for my command line environments. I had found a couple different ways to do this, especially since one extra method was specifically crafted for the fish shell environment.

It seems the root cause was either:

  • initializing RVM more than once, because I had multiple statements, one per terminal configuration file, and because of how they were chained, I was not aware of the others that were automatically added.
  • Or, somehow statements were added that mixed the initialization for one terminal environment, say fish, and were being run in my other terminal environment, bash, or vice versa. This can be seen in my details below where the broken bash PATH has some of the paths delimited by :s, but then others also included by spaces, which is incorrect syntax for bash, but correct for fish.
  • Or both were happening!

Then the other part of the root problem was that there seems that an RVM/direnv related bug crept up recently regarding the trap function. I probably encountered this again by having one of the other problematic releases of RVM that could be caused by:

  • A re-installation: curl -sSL https://get.rvm.io | bash
  • A manual update: rvm get head
  • An automatic update (that I had just done) by adding rvm_autoupdate_flag=2 to ~/.rvmrc

This problem should be fixed as of March 30th, 2016, or release 1.26.11:

The Story

After fighting with the GNU utilities to do a complete search of the file system, peeking inside file contents, I used Atom to do this to more success, and found that the only occurrence of shell_session_update was found in the /etc/bashrc_Apple_Terminal file mentioned by Zanchey (besides history files and such). I'm also not sure why that was being run because I was using iTerm(2), and the value of $TERM_PROGRAM in that case is iTerm.app and not Apple_Terminal.

It also didn't help that I, for some reason, had to manage the RVM installation more than once, going through the installation process, which apparently adds configuration to several 'dotfiles' already, where I had also manually added some or the lines.

Along with that I had made a .bashrc file and linked to it from .bash_profile on my Mac, since it apparently did not exist by default. I had previously read on a Linux system that, by convention, .bash_profile is good for some customizations, and .bashrc is good for others such as defining user aliases and functions, or vice versa. So I was not accustomed to looking inside the .bash_profile file, and especially not the .profile file, all in the user directory, which similar system copies as well. Let's also not forget a path_helper is in the mix(!), but did not seem to contribute to any problems.

The possible ways to set-up the environment, that may be correct or not, are as follows:

More Details

For more incredible verbosity, here are some example paths I captured between by different environments while debugging the problem:

Original (broken) fish PATH

/Users/username/.rvm/gems/ruby-2.0.0-p648/bin /Users/username/.rvm/gems/ruby-2.0.0-p648@global/bin /Users/username/.rvm/rubies/ruby-2.0.0-p648/bin /Users/username/.rvm/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/munki /Users/username/.rvm/bin

'Naturally' better fish PATH

/usr/local/opt/coreutils/libexec/gnubin /usr/local/opt/findutils/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/munki

Original (broken) bash PATH

/libexec/gnubin:/bin:/Users/username/.rvm/gems/ruby-2.0.0-p648/bin /Users/username/.rvm/gems/ruby-2.0.0-p648@global/bin /Users/username/.rvm/rubies/ruby-2.0.0-p648/bin /Users/username/.rvm/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/munki:/Users/username/.rvm/bin

'Manually' Fixed bash PATH

/libexec/gnubin:/bin:/Users/username/.rvm/gems/ruby-2.0.0-p648/bin:/Users/username/.rvm/gems/ruby-2.0.0-p648@global/bin:/Users/username/.rvm/rubies/ruby-2.0.0-p648/bin:/Users/username/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki:/Users/username/.rvm/bin:/Users/username/.rvm/bin

'Naturally' better bash PATH

/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki

Notes:

  • The 'original's were from starting the brand new environment in either command line interpreter while having the problem.
  • The 'manual' is of course when I took the incorrect path string, fixed the syntax errors, and saw more proper operation of the interpreter, so I knew what to expect when continuing to fix the root cause.
  • The 'natural's were from when I first skipped loading my terminal environment configuration files such as .bashrc and so on, and then eventually had them run after the problem was solved.
`rvm get head`, а затем` rvm reinstall `для каждой версии в конечном итоге исправили для меня TomFuertes 8 лет назад 0
Если используется метод установки curl: `curl -sSL https://get.rvm.io | bash -s head --ruby` rynop 7 лет назад 0
Этот ответ - золото. Полезно и тщательно. TehShrike 7 лет назад 0
У меня была эта "проблема" после установки bash-git-prompt. Переустановка rvm выглядела слишком много _naaah_. Так что я просто переехал`до конца в моем` .bash_profile`. Исправлена. A.D. 7 лет назад 0
Я обычно обнаруживал, что исправил это другое сообщение об ошибке, на которое ссылаются здесь: http://stackoverflow.com/questions/18276701/getting-warning-path-is-not-properly-set-up-when-doing-rvm-use- 2-0-0-дефолт «Внимание! PATH не настроен должным образом ». Может быть, у вас были другие источники, которые делали бы это более похожим на эту проблему? Это точно не имеет смысла, но все возможно. Pysis 7 лет назад 0
добавление `rvm get head` не работает в travis, см. https://github.com/travis-ci/travis-ci/issues/9511 timotheecour 6 лет назад 0
6
Ajit Singh

I too had the same problem. Later I found that there is already an issue present in rvm repo for this. And they have fixed it in one of the pull requests.

To fix this either upgrade the rvm to the latest version or point it to the current development revision.

rvm get head 

For more details refer to this post.

Не могли бы вы процитировать соответствующие части по ссылке? В противном случае это выглядит так, будто вы пытаетесь продвигать свой собственный блог. Burgi 8 лет назад 1
это не работает в Трэвисе, см. https://github.com/travis-ci/travis-ci/issues/9511 timotheecour 6 лет назад 0