I want to run the laravel command on my machine. But I always get laravel: command not found. I do have globally required Laravel on composer. Most people say that you need to add composer to your path via this command: export PATH=~/.composer/vendor/bin:$PATH. But I don't have the directory ~/.composer'.
The problem is that I can't find the location of composer. Does somebody know the correct location which I need to export to my PATH. Thanks!
Your Composer path is likely ~/.config/composer/vendor/bin. Try adding that instead.
See also Why is COMPOSER_HOME empty?
Related
I'm trying to install and run Laravel on my Mac machine, but my command line doesn't recognize laravel and responds to all laravel commands with "bash: laravel: command not found". I know that the composer bin folder needs to be added to the $PATH, so I went to my home folder and, since none of the profile files I was told to look for were present, I created a .bash_profile file and added the line "export PATH = $HOME/.composer/vendor/bin:$PATH" to it. However, after saving this and restarting my terminal, laravel is still not recognized. Does anyone see what I'm doing wrong here?
I assume you are trying to do laravel new blog. To work you should call composer global require laravel/installer.
In case this doesn't work for you use composer create-project --prefer-dist laravel/laravel blog
I am a newbie in Laravel and want to set up my first Laravel project. I am following the Laravel documentation. So far, I installed Composer and downloaded the Laravel installer using Composer.Now, the documentation says:
Make sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system.
To set up $PATH variable I have added this line of code in ~/.bashrc file:
export PATH="$PATH:$HOME/.composer/vendor/bin"
But, when I type laravel the terminal says:
laravel: command not found
I searched similar question but couldn't find the right $PATH variable for my OS which is Linux Mint 18.Can you tell me the right $PATH variable or equivalent directory for my OS?Thank You.
After doing more searching, Finally I got the answer to my own question. I find it here:
composer path for Linux Mint 18 This line of code should be added at the bottom of ~/.bashrc fie:
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Make sur composer is configured
composer global require "laravel/installer"
Then, you have to install Laravel first, with this command
composer global require "laravel/installer"
A simple Google search will do. Check the link below:
https://forums.linuxmint.com/viewtopic.php?t=180380
After install laravel using ' composer global require "laravel/installer" '
use the code code below. Its worked for me.
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
I have installed composer on Centos 7 virtualbox with PHP 5.6.27. I will show the commands that I have used and the issues that I am now having. I should first say that all of these commands have worked on previous installations.
Okay so for starters here is what I used to install composer.
curl -sS https://getcomposer.org/installer | php
Followed by
mv composer.phar /usr/local/bin/composer
Now I am trying to install laravel via the commands listed below.
composer global require "acacha/adminlte-laravel-installer=~3.0"
Up to this point all of the commands listed above have successfully worked.
Now here is the current problem. When I try to run the following command I get an error.
laravel new laravel-with-admin-lte
-bash: /root/.composer/vendor/bin/laravel: No such file or directory.
I have tried a whole set of remedies for this message but it cannot find the .composer directory. Can anyone tell me where the correct .composer directory is and how I can modify it so that it looks to the proper location to finalize this installation?
I appreciate any solutions that you can provide me. I have struggled with this for two days straight and have googled everything under the sun. Hopefully, someone on here has had a similar solution with a valid resolution.
Put an alias to the freshly installed Laravel installer in your user configuration .bashrc:
nano ~/.bashrc
And place this inside the file:
alias laravel='~/.config/composer/vendor/bin/laravel'
And run the following to make sure your bashrc profile is reloaded:
source ~/.bashrc
laravel new project
download as superuser
download installer
sudo composer global require "laravel/installer=~1.1"
setting up path
export PATH="~/.composer/vendor/bin:$PATH"
check laravel command
laravel
I had the same problem, so I changed the directory.
This is the directory where your bash was created: /root/.config/composer
enter image description here
but when excute the laravel command, the system search en the directory : bash: /root/.composer/vendor/bin/laravel:
enter image description here
So, just you need to change the address /root/.config/composer/vendor to /root/.composer/vendor.
PD. sorry I am learning english, so it is a little bad.
I am trying to install laravel using composer
composer global require "laravel/installer"
but i get
I just finished reinstall my windows 7, before that laravel installation was always succesful and now it is not.. maybe someone know how solve this problem?
According to Laravel's Documentation
Make sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system.
In case of Windows you should ad that $PATH to your enviornment variables.
I have composer installed, but checking the Laravel docs, I'm struggling with:
"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."
I'm not sure what to do here, could someone explain it to me?
Go to terminal and paste the next line:
nano ~/.bash_profile
After that paste the next line in nano:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Done. Restart your terminal and enjoy laravel.
The PATH environment variable tells your system where to look when you run a command. By default ~/.composer/vendor/bin will not be in your PATH. Therefore, if you just attempt to run the command laravel after installing it via composer, your terminal will give you an error saying the command is not found. But if you use the entire path to the command (~/.composer/vendor/bin/laravel), it will execute successfully.
When you run the command composer global require "laravel/installer=~1.1", composer puts the laravel installer into the directory ~/.composer/vendor/bin (in *nix, ~ represents your home directory). Adding ~/.composer/vendor/bin to your PATH allows you to just execute the command laravel instead of having to use the full path of ~/.composer/vendor/bin/laravel.
Helpful Stuff:
How to set/change your PATH environment variable in OSX
Installing composer packages globally