[英]laravel new sh: composer: command not found
The problem happens whenever I call the Laravel installer: laravel new app.每当我调用 Laravel 安装程序时都会出现问题:laravel new app。
I get sh: composer: command not found
我得到
sh: composer: command not found
When I call composer create-project --prefer-dist laravel/laravel app
everything works fine.当我调用
composer create-project --prefer-dist laravel/laravel app
一切正常。
I'm using zsh and my export paths looks as follows:我正在使用 zsh,我的导出路径如下所示:
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.我能找到的最佳解决方案是在
~/.zshrc
文件中创建一个函数。
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.这样我就可以运行
ln app
并用更短的语法生成一个新的 Laravel 应用程序。
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.我无法弄清楚为什么运行
laravel new app
给出以下输出: sh: composer: command not found
and failed to generate a new app。
If you are on macOS , You can do:如果您在macOS 上,您可以执行以下操作:
cd /usr/local/bin
mv composer.phar composer
sudo chmod +x composer
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.