The problem happens whenever I call the Laravel installer: laravel new app.
I get sh: composer: command not found
When I call composer create-project --prefer-dist laravel/laravel app
everything works fine.
I'm using zsh and my export paths looks as follows:
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=/opt/homebrew/bin:$PATH
export ZSH="/Users/konstantinkrumov/.oh-my-zsh"
export PATH=~/.composer/vendor/bin:$PATH
I also have an alias for composer
alias composer="php /usr/local/bin/composer/composer.phar
When I run which composer I get: composer:
aliased to php /usr/local/bin/composer/composer.phar
So far I have tried to:
non of the above seem to work
The best solution which I was able to find was to make a function in the ~/.zshrc
file.
Function looks like this:
ln() {
composer create-project --prefer-dist laravel/laravel $1;
}
This way I can run ln app
and generate a new laravel app with a shorter syntax.
I was unable to figure out why running laravel new app
gave the following output: sh: composer: command not found
and failed to generate a new app.
If you are on macOS , You can do:
cd /usr/local/bin
mv composer.phar composer
sudo chmod +x composer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.