tpm icon indicating copy to clipboard operation
tpm copied to clipboard

I get error 127 when trying to install.

Open mrt181 opened this issue 8 years ago • 45 comments

Pressing prefix + I gives me this message:

'~/.tmux/plugins/tpm/tpm' returned 127

TMUX environment reloaded.

Done, press ENTER to continue.

I have the prerequisites installed

username > ~ > uname -s
CYGWIN_NT-6.1
username > ~ > which bash
/usr/bin/bash
username > ~ > which dirname
/usr/bin/dirname

This is my tmux.conf

# ctrl-a as prefix instead of ctrl-b
unbind C-b
set -g prefix C-a
# 'C-a C-a' sends C-a keypress to the current window
bind C-a send-prefix

# mouse version >= 2.1
set -g mouse on

# mouse tmux <= 2.0
#set -g mode-mouse on
#set -g mouse-resize-pane on
#set -g mouse-select-pane on
#set -g mouse-select-window on

# vi mode
set-window-option -g mode-keys vi

# vim features
unbind [
bind Escape copy-mode
bind p paste-buffer
bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection
bind C-p run "tmux set-buffer \"$(getclip)\"; tmux paste-buffer"

# restore clear screen
bind C-l send-keys 'C-l'
# restore kill line
bind C-k send-keys 'C-k'
# source this file after changes
bind R source-file ~/.tmux.conf
# source this file after changes
bind s set-window-option synchronize-panes

# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

#### COLOUR (Solarized dark)

# default statusbar colors
set -g status-bg black #base02
set -g status-fg yellow #yellow
set -g status-attr default

# default window title colors
set -g window-status-fg brightblue #base0
set -g window-status-bg default
#set-window-option -g window-status-attr dim

# active window title colors
set -g window-status-current-fg brightred #orange
set -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright

# pane border
set -g pane-border-fg black #base02
set -g pane-active-border-fg brightgreen #base01

# message text
set -g message-bg black #base02
set -g message-fg brightred #orange

# pane number display
set -g display-panes-active-colour blue #blue
set -g display-panes-colour brightred #orange

# clock
set -g clock-mode-colour green #green

# statusline
source-file ~/.tmuxline.conf

# TPM
# list of plugins
set -g @shell_mode 'vi'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"
run '~/.tmux/plugins/tpm/tpm'

mrt181 avatar Jan 26 '16 12:01 mrt181

I am using cygwin and had the same problem. This worked for me:

$ git diff
diff --git a/tpm b/tpm
index 570d58b..f764746 100755
--- a/tpm
+++ b/tpm
@@ -41,7 +41,7 @@ set_tpm_path() {
 #       - no errors raised if directory does not exist
 # Files are sourced as tmux config files, not as shell scripts!
 source_plugins() {
-       "$SCRIPTS_DIR/source_plugins.sh" >/dev/null 2>&1
+       "$SCRIPTS_DIR/source_plugins.sh" 2>&1
 }

 # prefix + I - downloads TPM plugins and reloads TMUX environment

vascoosx avatar Feb 10 '16 02:02 vascoosx

@vascoosx can you explain why?

jbnicolai avatar Feb 21 '16 11:02 jbnicolai

@jbnicolai I do not know. It used to work without that patch and I checked the existence of /dev/null and it was there. I also tried to see if an error occurred with ls > /dev/null but there was no issue.

vascoosx avatar Feb 22 '16 03:02 vascoosx

I get the same error, It doesn't seem to download the plugins at all. Weirdly it seems to work normally on babun, don't know what they are doing differently...

Edit: The only difference I can see is that cygwin's tmux is 64bit while babun's is 32bit. Edit 2: Installed cygwin in 32bit and it works now, so there's that.

TimDeve avatar Mar 27 '16 12:03 TimDeve

For everyone get 127 error, make tmux command available for all users may be fix this problem.

I'm using a mac, and install tmux use homebrew, it will be installed at /usr/local/bin/tmux, after I make a symbol link to /usr/bin/tmux, everything will be working.

$ sudo ln -s /usr/local/bin/tmux /usr/bin/tmux

wd avatar Sep 10 '16 15:09 wd

I too was having this issue on OpenBSD 5.9 and 6.0 on 64bit.

For me this was as simple as installing bash as only sh is installed by default.

dpremy avatar Sep 28 '16 15:09 dpremy

In newer versions of macOS you can't write to /usr/bin, not even with sudo. So you can't run:

sudo ln -s /usr/local/bin/tmux /usr/bin/tmux

For anyone else having this problem you need to reboot your mac and press ⌘+R when booting up. Then go into Utilities > Terminal and type the following commands:

csrutil disable
reboot

This is a result of System Integrity Protection. And it is not recommended to disable it.

luisdavim avatar Feb 28 '17 09:02 luisdavim

@luisdavim did you find any other workaround or is disabling the System Integrity Protection the only solution?

smurex avatar Jul 10 '17 17:07 smurex

@smurex I've got this fixed. This problem is because tmux's run-shell command runs a shell which doesn't read from user configs, thus tmux installed in /usr/local/bin will not be found.

A better solution is shown the next comment, please ignore this one.


```
cd "$(dirname "$0")"

export PATH="/usr/local/bin:$PATH"

# plugins you need
plugins/tmux-yank/yank.tmux
plugins/tmux-recurrect/resurrect.tmux
plugins/tmux-prefix-highlight/prefix_highlight.tmux
```

~~~Then comment out all `run-shell/run` lines in your `~/.tmux.conf`, and add `run ~/.tmux/run.tmux` at the bottom. If you have extra configurations to the plugins, leave them as is.~~~

shouya avatar Aug 02 '17 03:08 shouya

A better way to get around with this is to insert the following line:

set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"

before the first run-shell/run command in your ~/.tmux.conf file, and leave everything else untouched.

shouya avatar Aug 02 '17 04:08 shouya

@shouya is this solution supposed to work if we add the line at the top of .tmux.conf? I tried both on top of the file and before the first run command. It isn't working. Perhaps this requires a restart of tmux server?

akashagarwal7 avatar Jan 28 '19 23:01 akashagarwal7

@akashagarwal7 You might need to restart tmux server for the changed config to apply.

shouya avatar Jan 29 '19 08:01 shouya

I too have got a 127 error, but that is solely due to my mistake: I did not fetch the tpm at all. The following line fixed my 127 error:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

llinfeng avatar Feb 16 '19 00:02 llinfeng

@akashagarwal7 make sure you do not have set -g update-enviroment that contains PATH. Otherwise, the set-env will be ignored.

noboruma avatar Jun 01 '19 11:06 noboruma

I'm getting this on OpenBSD 6.5 with the OpenBSD stock tmux.

The reason is because this runs $HOME/.tmux/plugins/tpm which runs $HOME/.tmux/plugins/scripts/check_tmux_version.sh. That script contains at call to tmux -V on line 52.

The OpenBSD version of tmux does not have the -V flag. Not sure of the right solution though, still too new to tmux to know if the OpenBSD version has the features you require.

kelp avatar Aug 30 '19 23:08 kelp

Cygwin users:

You can get further insight by executing the installation script directly with ~/.tmux/plugins/tpm/scripts/install_plugins.sh. I found this was showing "download fail" for all plug-ins. On further inspection it was the git command specifically causing it.

Looks like there was a possible conflict between "Git for Windows" and Git through Cygwin's package manager. I resolved this problem by adding the git package via Cygwin installer, then remove it, then restart tmux so that Git for Windows is used.

Finally, I still get code 127 by pressing prefix + I, though calling the script it invokes directly with .tmux/plugins/tpm/bindings/install_plugins works fine:

TMUX environment reloaded.

Done, press ESCAPE to continue.

Possibly related is the space in my user profile path? '/cygdrive/c/Users/Adam Reece/.tmux/plugins/tpm/bindings/install_plugins'

AdamReece-WebBox avatar Apr 30 '20 12:04 AdamReece-WebBox

I got the error simply because of wrong path ~/.tmux/plugins/tpm/tpm

zyfyy avatar May 10 '20 11:05 zyfyy

I too have got a 127 error, but that is solely due to my mistake: I did not fetch the tpm at all. The following line fixed my 127 error:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

I have the same problem, verify if the ~/.tmux/plugins/tpm exist or clone it.

phaalonso avatar Jul 11 '20 12:07 phaalonso

I too have got a 127 error, but that is solely due to my mistake: I did not fetch the tpm at all. The following line fixed my 127 error:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

this problem still exists (at least in my machine), tmux 3.1c, zsh 5.3, macOS Mojave, and cloning the non-existing tpm plugin fixed it!

ical10 avatar Dec 13 '20 12:12 ical10

Thanks for the suggestion. Unfortunately that doesn't resolve the issue on Cygwin.

AdamReece-WebBox avatar Dec 14 '20 08:12 AdamReece-WebBox

If you are using Homebrew >3.0.0, you'll need to add this to your PATH in tmux.conf:

set-environment -g PATH "/opt/homebrew/bin:/usr/local/bin:/bin:/usr/bin"

Notice /opt/homebrew/bin.

carlosonunez avatar Feb 08 '21 20:02 carlosonunez

Hello! I still have this error.

~/.tmux/tmux.conf
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# vim-like pane bindings
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R

# Options
set-option -g prefix C-b
set-option -g status-interval 5
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'

set -g status-position bottom
set -g mouse on

# Terminal Setup
set -g default-terminal "screen-256color"
set-environment -g PATH "/opt/homebrew/bin:/usr/local/bin:/bin:/usr/bin"

run-shell "echo 'which tmux'"
run-shell "which tmux"

# Set up Powerline
run-shell "powerline-daemon -q"
source /usr/local/lib/python3.9/site-packages/powerline/bindings/tmux/powerline.conf

run-shell "echo 'powerline done'"

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'

run-shell "echo 'set plugins'"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.config/tmux/plugins/tpm/tpm'

run-shell "echo 'initialized'"
Output from : source ~/.config/tmux/tmux.conf
which tmux
/usr/local/bin/tmux
powerline done
set plugins
initialized
'~/.config/tmux/plugins/tpm/tpm' returned 127
  • tmux -V: tmux 3.2a
  • shell: fish, version 3.3.1

bennypowers avatar Nov 03 '21 19:11 bennypowers

Does the path to your home directory have any spaces?

AdamReece-WebBox avatar Nov 04 '21 07:11 AdamReece-WebBox

Does the path to your home directory have any spaces?

$ echo $HOME
/Users/bennyp

bennypowers avatar Nov 04 '21 07:11 bennypowers

I should have mentioned earlier, this is in hyper terminal as well as macOS terminal

bennypowers avatar Nov 04 '21 08:11 bennypowers

As a testament to how good this plugin manager is, I rarely have to deal with it. As a result, I seem to have forgotten a few things when getting my MI MacPro up and running. The mistake was evident when I got the 127 message described in this issue.

Just to share what I should have remembered to perhaps benefit the next:

  1. make sure to install tpm; unless your config checks for it each time...

  2. for whatever reason, I now need to include the following just before the run "$HOME/.tmux/plugins/tpm/tpm" command (I suspect that my previous .profiles and the like, set the path in addition to what I was doing with fish; not so in the fresh new system):

      set-environment -g PATH "/opt/homebrew/bin:/usr/local/bin:/bin:/usr/bin"
    
  3. Once you restart your tmux server (or try to trigger the install with tmux source ~/.tmux.conf), you can test/confirm the plugin manager is working as expected by updating your plugins:

      `Prefix U`
    

The command generates a message with a list of all of the installed plugins, and an option to update any one of them by name or "all". You may need to run this twice in order to get the full list.

pdating all plugins!                                                                                     [0/0]
  "tmux-yank" update success
  "tmux-resurrect" update success
  "tmux-sensible" update success
  "tmux-battery" update success
  "tpm" update success
TMUX environment reloaded.
Done, press ENTER to continue.

I hope this helps.

EdmundsEcho avatar Dec 16 '21 23:12 EdmundsEcho

Moved to WSL2 with Ubuntu-20.04

This is my environment:

> tmux -V
tmux 3.0a

This is my TPM config in .tmux.conf

# TPM
# list of plugins
set -g @plugin '.tmux-plugins/tpm'
set -g @plugin '.tmux-plugins/tmux-sensible'
set -g @plugin '.tmux-plugins/tmux-yank'
set -g @plugin '.tmux-plugins/tmux-open'
set -g @plugin '.tmux-plugins/tmux-resurrect'
set -g @plugin '.tmux-plugins/tmux-continuum'

set -g @continuum-restore 'on'

set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"
run '~/.tmux/plugins/tpm/tpm'

This is what I get when running the install script:

> ./.tmux/plugins/tpm/scripts/install_plugins.sh
Already installed "tpm"
Installing "tmux-sensible"
  "tmux-sensible" download fail
Installing "tmux-yank"
  "tmux-yank" download fail
Installing "tmux-open"
  "tmux-open" download fail
Installing "tmux-resurrect"
  "tmux-resurrect" download fail
Installing "tmux-continuum"
  "tmux-continuum" download fail

This plugin manager never worked for me.

mrt181 avatar Feb 02 '22 11:02 mrt181

Hi,

I recently had a similar issue in WSL2 with Ubuntu-20.04.

Reloading the tmux config was giving me the original error from this issue:

'~/.tmux/plugins/tpm/tpm' returned 127

TMUX environment reloaded.

Done, press ENTER to continue.

In my case, it turned out that the problem was not with tpm itself, but with my git configuration. I was loading these plugins:

set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @plugin 'schasse/tmux-jump'

I tried to execute any of them manually, and I realized they were all failing for the same reason: they had CRLF endings.

I have "autocrlf = true" in my .gitconfig. Changing the value isn't an option for me, so I changed my git attributes file instead:

~/.gitconfig

[core]
     attributesFile = ~/.config/git/gitattributes

~/.config/git/gitattributes

*.sh text eol=lf

After deleting all my plugins and using tpm to download them again, everything worked perfectly. I didn't even need to keep the line "set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"" in my tmux.conf.

I hope this helps.

sarahlagh avatar Aug 22 '22 17:08 sarahlagh

I got the same error on Debian. Solution: After "apt install tmux-plugin-manager", the correct path is "/usr/share/tmux-plugin-manager/tpm".

paulcobbaut avatar Sep 12 '22 09:09 paulcobbaut

I too have got a 127 error, but that is solely due to my mistake: I did not fetch the tpm at all. The following line fixed my 127 error:

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

this operation solved my 127 error, but then I have a 1 error

'~/.tmux/plugins/tpm/tpm' returned 1

back2childhood avatar Mar 29 '23 01:03 back2childhood