IT story

라 라벨 설치 : ~ / .composer / vendor / bin 디렉토리를 PATH에 배치하는 방법?

hot-time 2020. 5. 9. 09:20
반응형

라 라벨 설치 : ~ / .composer / vendor / bin 디렉토리를 PATH에 배치하는 방법?


Ubuntu 14.04를 사용하고 있으며 Laravel을 설치하는 데 사용할 수있는 모든 방법을 사용해 보았습니다. 내가 시도하는 모든 오류 메시지. 이제 빠른 시작 설명서의 첫 번째 방법, 즉 Laravel Installer를 통해 시도하고 있지만 " 터미널에서 laravel 명령을 실행할 때 laravel 실행 파일을 찾을 ~/.composer/vendor/binPATH있도록 디렉토리를 디렉토리에 배치해야합니다 ." 제 질문은 어떻게합니까? 이것은 간단한 질문 일 수 있지만 정말 좌절하고 도움을 주셔서 감사합니다.


이 폴더를 PATH 환경 변수 유형에 두려면

export PATH="$PATH:$HOME/.composer/vendor/bin"

이렇게하면 폴더가 기존 PATH에 추가되지만 현재 터미널 세션에서만 활성화됩니다.

자동으로 설정하려면 사용중인 쉘에 따라 다릅니다. bash의 경우 $HOME/.bashrc선호하는 편집기 사용 하여이 행을 추가 하거나 쉘에 다음을 입력 할 수 있습니다.

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

작동하는지 확인하려면 로그 아웃 한 후 다시 로그인하거나 실행하십시오.

source ~/.bashrc

껍질에.

추신 :이없는 다른 시스템의 경우 ~/.bashrc에도 넣을 수 있습니다~/.bash_profile

PSS : 최신 라 라벨의 경우을 착용해야 $HOME/.config/composer/vendor/bin합니다 PATH.

PSSS :이 폴더를 다른 쉘이나 GUI의 경로에 두 export려면 ~/.profile( https://help.ubuntu.com/community/EnvironmentVariables )에 상기 명령을 추가해야합니다 .


자세한 지침 :

~ / .bashrc에 다음 줄을 추가하십시오.

export PATH="$PATH:~/.composer/vendor/bin"

그런 다음 다시로드하십시오.

source ~/.bashrc

올바르게 추가되었는지 확인하십시오.

echo $PATH

/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/web/bin:~/.composer/vendor/bin

전 세계적으로 작곡가가 설치된 Ubuntu 16.04 LTS에서 이것은 나를 위해 일했습니다.

/your/home/.config/composer/vendor/bin에있는 composer bin 폴더의 경로를 지정하여 홈 디렉토리에서 .bashrc 파일을 편집하십시오.

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

source ~/.bashrc

작동하지 않으면 composer bin 디렉토리의 경로를 확인하고 터미널을 닫았다가 다시여십시오. 그렇지 않으면 우분투에서 로그 오프하고 로그인하십시오.

우분투 18.04에서도 작동합니다. 의견을 보내 주셔서 감사합니다.


Yosemite (OS X 10.10.5)에서 PATH를 설정하려면 아래 명령을 사용하십시오.

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile

터미널을 종료하고 다시 시작하거나 다음을 사용하려면 :

source ~/.bash_profile

저를 도와주었습니다. 다른 누군가를 도울 수 있기를 바랍니다!


나는 위의 모든 것을했고 그것은 나를 위해 작동하지 않았다.

방금 이것을 터미널에 복사했는데 저에게 효과적이었습니다.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Mac OS X 버전 10.9.5에서 PATH를 설정하기위한 것입니다.

사용자 프로필을 사용하기 때문에 $ HOME을 추가하려고했습니다.

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

사용자 프로필을 사용하지 않는 경우 :

echo 'export PATH="$PATH:~/.composer/vendor/bin"' >> ~/.bashrc

Then reload:

source ~/.bashrc

I hope this help you.


For Linux Mint 18: edit ~/.bashrc and add this line to it at the bottom:

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

then resource .bashrc (type in console):

source ~/.bashrc (or close and reopen the terminal)

test it by typing in the console:

echo $PATH

or type in console:

laravel

Open the Mac Terminal:

vi ~/.bashrc

If you haven't used vi, it may look a little funny at first, so enter the following code carefully, in order:

i
export PATH="$PATH:$HOME/.composer/vendor/bin"

PRESS ESC

:
w

PRESS ENTER

:
q

PRESS ENTER

Now you should have returned to the normal terminal view.

Check that composer now has the correct path:

cd ~/.composer
echo $PATH

If you see the path including your file directory, (e.g. /Users/JeffStrongman/.composer/vendor/bin), you're good to go.

cd

Then run your installation. I ran into this problem, while configuring my Mac to use Laravel Valet.

Example (optional)

valet install

Adding export PATH="$PATH:~/.composer/vendor/bin" to ~/.bashrc works in your case because you only need it when you run the terminal.
For the sake of completeness, appending it to PATH in /etc/environment (sudo gedit /etc/environment and adding ~/.composer/vendor/bin in PATH) will also work even if it is called by other programs because it is system-wide environment variable.
https://help.ubuntu.com/community/EnvironmentVariables


MacOS Sierra User:

make sure you delete MAAP and MAAP Pro from Application folder if you have it installed on your computer

be in root directory cd ~ check homebrew (if you have homebrew installed) OR have PHP up to date

brew install php70

export PATH="$PATH:$HOME/.composer/vendor/bin"

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile

source ~/.bash_profile

cat .bash_profile

make sure this is showing : export PATH="$PATH:$HOME/.composer/vendor/bin"

laravel

now it should be global


For Ubuntu 16.04

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

source ~/.bashrc

AWS Ubuntu 18.04 LTS

Linux ws1 4.15.0-1023-aws #23-Ubuntu SMP Mon Sep 24 16:31:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc && source ~/.bashrc

Worked for me.


this is what I added in my .bashrc file and worked.

export PATH="$PATH:/home/myUsername/.composer/vendor/bin"


For Ubuntu it's like this: add this line at the end of file ~/.bashrc

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

and then reload path by executing:

source ~/.bashrc

The Composer bin directory is set and stored in bin-dir config variable and can be different depending on your setup. Running the command composer global config bin-dir --absolute will tell you the absolute path to your global composer bin directory. Using this command you can modify your .bash_profile to add it to your PATH exactly how it is configured.

# Add Composer bin-dir to PATH if it is installed.
command -v composer >/dev/null 2>&1 && {
        COMPOSER_BIN_DIR=$(composer global config bin-dir --absolute 2> /dev/null)
        PATH="$PATH:$COMPOSER_BIN_DIR";
}
export PATH

I did this and it works on osx:

lunch your terminal

 nano ~/.bash_profile 

And paste

 export PATH=~/.composer/vendor/bin:$PATH

press control + x

press the y key

press the return / enter key


In case someone uses ZSH, all steps are the same, except a few things:

  1. Locate file .zshrc
  2. Add the following line at the bottom export PATH=~/.composer/vendor/bin:$PATH
  3. source ~/.zshrc

Then try valet, if asks for password, then everything is ok.


add environment variable into bashrc file

For Ubuntu 17.04 and 17.10:

echo 'export PATH="~/.config/composer/vendor/bin"' >> ~/.bashrc

For Ubuntu 18.04

echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

to Check environment variable working or not first reload the bashrc file

source ~/.bashrc

if not working any method then First Check Where is install Composer to Check Run This Command :

locate composer -l 1

then Copy Output add output into this line and run again command.

 echo 'export PATH="OUTPUTHERE/vendor/bin"' >> ~/.bashrc

After Successfully Laravel Command Work Give a Permission To Parent Folder (for example u are using apache server than give permission to apache web listing directory like that)

sudo chown $USER:$USER -R /var/www/html/

To solve this problem make sure you find the path of composer.phar first

example mine is something like this

alias composer="php /Users/Your-username/composer.phar"

Go to cd Users > Your user > Command ls and see if composer.phar is there if yes then add the above line to your .bash_profile. Make sure you change the username to your own.

Hope this help you out

참고URL : https://stackoverflow.com/questions/25373188/laravel-installation-how-to-place-the-composer-vendor-bin-directory-in-your

반응형