zsh composer не смог открыть входной файл на терминале Mac - PullRequest
0 голосов
/ 03 апреля 2019

Я новичок в php, и просто установите composer на мой терминал Mac из этого учебника .

Мой эмулятор терминала - iterm2, на котором установлен oh-my-zsh. когда я набираю эту команду:

curl -sS https://getcomposer.org/installer | php

это шоу:

Композитор (версия 1.8.4) успешно установлен в: /Users/lutfiyanra/composer.phar Используйте это: php composer.phar

Я думаю, мне нужно настроить ~ / .zshrc и добавить команду:

alias composer="php /usr/local/bin/composer.phar"

поэтому после того, как я добавлю эту команду и сохраню ее, я перезагружаю ее с помощью этой команды: source ~/.zshrc

но, когда я набираю: composer version или composer отображается

Не удалось открыть входной файл: /Users/lutfiyanra/.composer/composer.phar

ниже мой .bash_profile

source ~/.profile
# added by Anaconda3 5.3.0 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

export PATH=/usr/local/bin:$PATH
export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.3.1/bin:$PATH
#alias composer="php /usr/local/bin/composer.phar"

и мой .zshrc

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/lutfiyanra/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
POWERLEVEL9K_MODE='awesome-fontconfig'
ZSH_THEME="powerlevel9k/powerlevel9k"


# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)

# source $ZSH/oh-my-zsh.sh

# User configuration
PATH="$HOME/anaconda3/bin:$PATH"

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Customise the Powerlevel9k prompts

alias "composer"="php ~/.composer/composer.phar"

prompt_zsh_showStatus () {
  state=`osascript -e 'tell application "Spotify" to player state as string'`;
  if [ $state = "playing" ]; then
    artist=`osascript -e 'tell application "Spotify" to artist of current track as string'`;
    track=`osascript -e 'tell application "Spotify" to name of current track as string'`;

    echo -n "$artist - $track";
  fi
}

# POWERLEVEL9K_STATUS_BACKGROUND="black"
# POWERLEVEL9K_STATUS_FOREGROUND="blue"
POWERLEVEL9K_BATTERY_CHARGING='yellow'
POWERLEVEL9K_BATTERY_CHARGED='green'
POWERLEVEL9K_BATTERY_DISCONNECTED='$DEFAULT_COLOR'
POWERLEVEL9K_BATTERY_LOW_THRESHOLD='10'
POWERLEVEL9K_BATTERY_LOW_COLOR='red'
POWERLEVEL9K_BATTERY_ICON='\uf1e6'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_freecodecamp battery dir vcs)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true #buat ngetik perintah dibawah prompt kiri
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="↱"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="↳\uF460\uF460\uF460 "
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(zsh_showStatus)
POWERLEVEL9K_TIME_BACKGROUND="black"
POWERLEVEL9K_TIME_FOREGROUND="blue"
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M}"
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time zsh_showStatus)
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
# Add the custom Medium M icon prompt segment
POWERLEVEL9K_CUSTOM_MEDIUM="echo -n $'\uf296' lutfiyanrzmd"
POWERLEVEL9K_CUSTOM_MEDIUM_FOREGROUND="blue"
POWERLEVEL9K_CUSTOM_MEDIUM_BACKGROUND="black"
# Add the custom freeCodeCamp prompt segment
POWERLEVEL9K_CUSTOM_FREECODECAMP="echo -n $'\uf408' lutfiyanra"
POWERLEVEL9K_CUSTOM_FREECODECAMP_FOREGROUND="blue"
POWERLEVEL9K_CUSTOM_FREECODECAMP_BACKGROUND="black"
# Load Nerd Fonts with Powerlevel9k theme for Zsh
POWERLEVEL9K_MODE='nerdfont-complete'
source ~/powerlevel9k/powerlevel9k.zsh-theme

# Set a color for iTerm2 tab title background using rgb values
function title_background_color {
  echo -ne "\033]6;1;bg;red;brightness;$ITERM2_TITLE_BACKGROUND_RED\a"
  echo -ne "\033]6;1;bg;green;brightness;$ITERM2_TITLE_BACKGROUND_GREEN\a"
  echo -ne "\033]6;1;bg;blue;brightness;$ITERM2_TITLE_BACKGROUND_BLUE\a"
}
ITERM2_TITLE_BACKGROUND_RED="18"
ITERM2_TITLE_BACKGROUND_GREEN="26"
ITERM2_TITLE_BACKGROUND_BLUE="33"
title_background_color
# Set iTerm2 tab title text
function title_text {
    echo -ne "\033]0;"$*"\007"
}
title_text Katanya Programmer

source /Users/lutfiyanra/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# prompt_zsh_showStatus () {
#   state=`osascript -e 'tell application "Spotify" to player state as string'`;
#   if [ $state = "playing" ]; then
#     artist=`osascript -e 'tell application "Spotify" to artist of current track as string'`;
#     track=`osascript -e 'tell application "Spotify" to name of current track as string'`;

#     echo -n "$artist - $track";
#   fi
# }

Что может быть не так?

1 Ответ

0 голосов
/ 03 апреля 2019

Композитор (версия 1.8.4) успешно установлен в: /Users/lutfiyanra/composer.phar Используйте его: php composer.phar

Как говорится, путь /Users/lutfiyanra/composer.phar,

нужно сделать псевдоним

php /Users/lutfiyanra/composer.phar

вместо php /usr/local/bin/composer.phar

Кажется, вы пропустили команду sudo mv composer.phar /usr/local/bin/, как говорится в руководстве по установке, которому вы следуете. Если вы выполните эту команду, тогда ваш псевдоним правильный. Если это не сработает, попробуйте сделать псевдоним:

alias composer="php ~/.composer/composer.phar"

вместо

alias "composer"="php ~/.composer/composer.phar"

Кроме того, там появляется сообщение об ошибке:

Не удалось открыть входной файл: /Users/lutfiyanra/.composer/composer.phar

Здесь выполняется поиск в файле composer.php в каталоге .composer , который не является правильным путем к этому файлу.

Альтернативный способ установки композитора: Более простой способ - это установить composer и любую другую программу в MacOS, используя homebrew. Если у вас его еще нет, вы можете установить Homebrew отсюда: https://brew.sh/

Затем вы можете установить composer или любой другой зарегистрированный пакет, как показано ниже:

brew install composer

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...