I ran sudo nano .bashrc and added
export PATH="~/.composer/vendor/bin:$PATH"
I restarted my terminal, ran laravel and received
laravel: command not found
I had run this prior to the above
composer global require laravel/installer
Also tried executing what I added to .bashrc in the terminal directly.
echo $PATH prints
/home/dev/.composer/vendor/bin:~/.composer/vendor/bin:~/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
The directory that Composer uses to store global binaries can be configured, and its default value depends on your operating system. You can see what it's set to by running
composer global config bin-dir --absolute
On your machine that outputs
/home/dev/.config/composer/vendor/bin
so that's what you should add to your PATH:
export PATH="~/.config/composer/vendor/bin:$PATH"
See also:
Why is COMPOSER_HOME empty?, which touches on one reason why you might see ~/.composer/ on some machines and ~/.config/composer/ on others.
Related
I have been trying to install composer on my Mac (running macOS Sierra). The composer.phar file is now located in /usr/local/bin/composer/ and it works properly when I'm not running composer as a root.
$ composer -V
Composer version 1.2.4 2016-12-06 22:00:51
However, when I try to run composer as a root (which of course is required to install dependencies), I get this:
$ sudo composer
sudo: composer: command not found
I have no single clue how to fix it, has anyone else had this?
it must be a composer.phar renamed to composer into /usr/local/bin/ , not a directory composer/
From : https://getcomposer.org/doc/00-intro.md
Globally#
You can place the Composer PHAR anywhere you wish. If you put it in a directory that is part of your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without directly using the php interpreter.
After running the installer following the Download page instructions you can run this to move composer.phar to a directory that is in your path:
mv composer.phar /usr/local/bin/composer
Note: If the above fails due to permissions, you may need to run it again with sudo.
Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding:
mkdir -p /usr/local/bin
Note: For information on changing your PATH, please read the Wikipedia article and/or use Google.
Now just run composer in order to run Composer instead of php composer.phar.
Receiving bash Homestead command not found
//After running composer global require "laravel/homestead=~2.0"
Changed current directory to C:/Users/Eric/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
//Inside my vi ~/.zshrc
export PATH=/Users/eric/AppData/Roaming/composer/vendor/bin:$PATH
export PATH="$laravel:$PATH"
I enabled Virtualization in BIOS
// Inside etc/hosts
Hosts:
127.0.0.1 homestead.app
192.168.10.10 homestead.app
//Inside environmental variables
C:\Users\Eric\AppData\Roaming\composer\vendor\bin
I can't find the homestead.yaml folder and I can't run any homestead commands. Any help with this would be appreciated, thanks!
Assuming that you already have VirtualBox, Vagrant, Git Bash (Git for Windows) installed and working you have two options to install Homestead
Using Git Bash:
Open git bash, navigate to home directory (typically it's C:\Users\{username}) and run
git clone https://github.com/laravel/homestead.git Homestead.
This will download Homestead in C:\Users\{username}\Homestead directory.
Then go to the Homestead installation directory
cd ~/Homestead and run bash init.sh.
This last command will create the Homestead configuration file (homestead.yaml).
Using composer
You need to have PHP and Composer already installed.
Open git bash and run composer global require "laravel/homestead=~2.0" command.
To take advantage of the Homestead CLI, make sure to add the Composer /bin directory to your PATH e.g. command prompt with admin privileges:
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
Then to create the Homestead configuration file (homestead.yaml) you have to run homestead init.
If none of the above don't work you can use Laragon http://laragon.org/.
Yesterday I've just installed Laravel with Behat on my VM Ubuntu 15.10.
Everything works fine, running the command $ vendor/bin/behat --init successfully created the features/ folder
but today something is weird, when running the $ vendor/bin/behat its saying vendor/bin/behat: line 1: ../behat/behat/bin/behat: No such file or directory
What's inside the vendor/bin/behat file?
This first single line ../behat/behat/bin/behat
accessing the actual location works $ vendor/behat/behat/bin/behat which basically means the file DOES exists
Please note that the issue is the same for the files in vendor/bin like doctrine phpspec etc..
You're having relative path problems. If your current directory contains vendor/ and you execute vendor/bin/behat, then ../behat/behat/bin/behat doesn't exist because it's going one directory up from your current directory, not vendor/bin/. For example:
$ cd $HOME/project
$ vendor/bin/behat
vendor/bin/behat: line 1: ../behat/behat/bin/behat: No such file or directory
That relative path becomes $HOME/project/behat/behat/bin/behat and not $HOME/project/vendor/behat/behat/bin/behat (note vendor present in the second path)
You need to be inside vendor/bin/ when executing behat:
$ cd $HOME/project/vendor/bin
$ behat
...
However, I don't see this being an issue with the latest behat install, line #1 is a well formed shebang. I think you might want to destroy your vendor install, update composer, etc, and reinstall Behat. Those files should not start with relative paths.
EDIT:
According to the composer docs, it creates symlinks to package binaries, as seen in the source code. You can verify this by running ls -l vendor/bin (all symlinks will have a -> pointing to their destination path). It would seem your original php composer.phar require ... was corrupt from the beginning.
I was following these instructions to install homestead on my Mac
http://pastebin.com/48PHSNC2
Homestead installed properly, but when it initialized, it didn't create a Homestead.yaml file. I have no idea how to reinitialize homestead or fix this. Reading through the installation guide Laravel gives you, it suggests using $ bash init.sh to create the .yaml file... unfortunately, this apparently doesn't exist for me either.
I used the composer command to install the CLI:
composer global require "laravel/homestead=~2.0"
Any ideas? I'm stumped...
I ran into a similar issue using Homestead 2.X (I dont care for Homestead 3 ATM).
basically do the following:
find the bash_init.sh file by running sudo find / -name init.sh
cd into the directory it's in, mine was in /Users/me/.composer/vendor/laravel/homestead/init.sh
make it executable, by running chmod +x init.sh
run ./init.sh
...
profit!
You can generate manually by clone git clone https://github.com/laravel/homestead.git Homestead. This will generate homestead.yaml file. Open and edit and change the parameters to fit your system configuration. For further reading
https://dev.to/ko31/installing-laravel-homestead-on-macos-5910
I m new to php and rabbitmq in debian(Linux). I have installed xampp, rabbitmq and also installed composer.phar in project directory using below command
/opt/lampp/htdocs/rabbitmq_demo# curl -s https://getcomposer.org/installer | /opt/lampp/bin/php
Now I use Composer to install the dependencies of the project using below command
composer.phar install
but it thrown an error as below
bash: php: command not found
I have preferred the link https://getcomposer.org/doc/00-intro.md
I want to prepare autoload.php
Please help me to create autoload under vendor directory.
You do not have a php cli program installed on your computer or it is not in your current $PATH variable. Please install PHP first or correct your $PATH environment variable.
Once you have this, run the composer.phar install again. This will download all dependencies listed in your composer.json file. Once the program completes, you will have a file ``vendor/autoload.php`. You can just require this file at the beginning of your own script and everything will be taken care of.
You need to add the path to the PHP command line (CLI) in the XAMPP install, to your bash environment. (You'd think the installer would do this!)
The XAMPP PHP CLI on Debian is at /opt/lampp/bin/php
So you need to add /opt/lampp/bin to your $PATH environment variable.
See this answer for the various options in modifying your path depending on who you want to be able to run PHP.
/etc/login.defs
/etc/environment
/etc/profile
~/.bashrc
In one of those files, you append to the path thus:
PATH=$PATH:/opt/lampp/bin
and re-login.