[英]Laravel command not found after adding Composer bin directory to PATH
I ran sudo nano .bashrc
and added 我运行了sudo nano .bashrc
并添加了
export PATH="~/.composer/vendor/bin:$PATH"
I restarted my terminal, ran laravel
and received 我重新启动终端,运行laravel
并收到
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. 还尝试直接执行在终端中添加到.bashrc
的内容。
echo $PATH
prints echo $PATH
打印
/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. 可以配置Composer用于存储全局二进制文件的目录,其默认值取决于您的操作系统。 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
: 这就是应该添加到PATH
:
export PATH="~/.config/composer/vendor/bin:$PATH"
See also: 也可以看看:
~/.composer/
on some machines and ~/.config/composer/
on others. ,这是您可能在某些计算机上看到~/.composer/
在其他计算机上看到~/.config/composer/
一个原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.