×°ÖÃlaravel¿ò¼Ü·ºÆðcommandÔõô°ì
×°Öà laravel ¿ò¼Ü·ºÆð command ¡°laravel¡± not found µÄ½â¾öÒªÁì
Laravel ÊÇÒ»¿îÊ¢ÐÐµÄ PHP Web ¿ª·¢¿ò¼Ü£¬Ðí¶à PHP ¿ª·¢Õ߶¼Ï²»¶Ê¹ÓÃËüÀ´¹¹½¨¸ßÐÔÄÜÇÒÒ×ÓÚά»¤µÄ Web Ó¦ÓóÌÐò¡£ÔÚʹÓà Laravel ¿ª·¢ Web Ó¦ÓóÌÐòµÄÀú³ÌÖУ¬Ðí¶à¿ª·¢Õ߶¼»áÓöµ½ Command ¡°laravel¡± not found µÄÎÊÌ⣬ÕâÊÇÔÚ×°Öà Laravel ¿ò¼Üʱ·ºÆðµÄÒ»ÖÖ³£¼û¹ýʧ¡£±¾ÎĽ«ÏÈÈÝÕâ¸öÎÊÌâµÄÔµ¹ÊÔÓÉ£¬ÒÔ¼°ÔõÑù½â¾ö¡£
ÎÊÌâÔµ¹ÊÔÓÉ
µ±ÄúÔÚÖÕ¶ËÖÐÊäÈë laravel ÏÂÁîʱ£¬ÈôÊÇ·ºÆð Command ¡°laravel¡± not found µÄ¹ýʧÌáÐÑ£¬Õâͨ³£Òâζ×ÅÄúµÄϵͳûÓÐ׼ȷװÖà Laravel ÏÂÁîÐй¤¾ß¡£Laravel ×°ÖÃÍê³Éºó£¬ÄúÐèҪͨ¹ý Composer ×°Öà laravel/installer °üÀ´»á¼û Laravel ÏÂÁîÐй¤¾ß¡£ÈôÊÇÄúûÓÐ×°ÖÃÕâ¸ö°ü£¬ÄÇôϵͳ¾Í»áÕÒ²»µ½ laravel ÏÂÁî¡£
½â¾öÒªÁì
ÏÂÃæÊǽâ¾ö Command ¡°laravel¡± not found µÄÎÊÌâµÄÏêϸ°ì·¨£º
°ì·¨ 1£º¼ì²é Composer ÊÇ·ñÒÑ׼ȷװÖÃ
ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
composer -v
ÈôÊÇ Composer ÒÑ׼ȷװÖã¬ÔòÖÕ¶ËÓ¦Êä³öÈçÏÂÐÅÏ¢£º
Composer version x.y.z …
ÈôÊÇÄú¿´µ½ Command not found µÄ¹ýʧÌáÐÑ£¬Çë²Î¿¼¹Ù·½Îĵµ×°Öà Composer¡£
°ì·¨ 2£ºÈ«¾Ö×°Öà Laravel ×°ÖÃÆ÷
ÔÚÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁ
composer global require laravel/installer
Õâ¸öÏÂÁȫ¾Ö×°Öà laravel/installer °ü£¬ÕâÑùÄú¾Í¿ÉÒÔÔÚÈκÎĿ¼ÏÂͨ¹ý laravel ÏÂÁî»á¼û Laravel ÏÂÁîÐй¤¾ßÁË¡£
°ì·¨ 3£ºÌí¼Ó Composer ÇéÐαäÁ¿
ÔÚ´ó´ó¶¼ÇéÐÎÏ£¬µ±ÄúÈ«¾Ö×°Öà Laravel ×°ÖÃÆ÷ºó£¬Äú»¹ÐèÒª½« Composer µÄÈ«¾Ö vendor Ŀ¼Ìí¼Óµ½ PATH ÇéÐαäÁ¿ÖС£ÕâÐèÒªÄú±à¼ ~/.bashrc¡¢~/.bash_profile »ò ~/.zshrc Îļþ£¬²¢ÔÚÆäÖÐÌí¼ÓÒÔÏÂÐУº
export PATH=”$PATH:$HOME/.composer/vendor/bin”
È»ºó£¬ÄúÐèÒªÖØмÓÔØ Shell ÉèÖÃÎļþ£¬»òÕßÖ±½ÓÔÚÖÕ¶ËÖÐÔËÐÐÒÔÏÂÏÂÁ
source ~/.bashrc
»òÕß
source ~/.bash_profile
»òÕß
source ~/.zshrc
Õâ¸öÏÂÁÖØмÓÔØËù±à¼µÄ Shell ÉèÖÃÎļþ£¬²¢Ê¹Ìí¼ÓµÄ·¾¶ÉúЧ¡£
°ì·¨ 4£ºÖØÆôÖÕ¶Ë
ÈôÊÇÄúÍê³ÉÁËÉÏÊö°ì·¨£¬²¢ÇÒͨ¹ýÖ´ÐÐ laravel ÏÂÁîÀ´½¨ÉèÐ嵀 Laravel ÏîĿʱ£¬ÖÕ¶ËÈÔ·ºÆð Command ¡°laravel¡± not found µÄ¹ýʧÌáÐÑ£¬ÇëʵÑéÖØÆôÖնˡ£ÖØÆôÖն˿ÉÄÜ¿ÉÒÔ½â¾öÕâ¸öÎÊÌâ¡£
×ܽá
Command ¡°laravel¡± not found µÄ¹ýʧÌáÐÑÊÇÔÚ×°Öà Laravel ¿ò¼Üʱ·ºÆðµÄÒ»ÖÖ³£¼û¹ýʧ£¬Í¨³£ÊÇÓÉÓÚûÓÐ׼ȷװÖà Laravel ÏÂÁîÐй¤¾ßµ¼Öµġ£Òª½â¾öÕâ¸öÎÊÌ⣬Äú¿ÉÒÔʹÓà composer ÏÂÁîÈ«¾Ö×°Öà laravel/installer °ü£¬²¢½« Composer µÄÈ«¾Ö vendor Ŀ¼Ìí¼Óµ½ PATH ÇéÐαäÁ¿ÖУ¬ÒÔ±ã»á¼û Laravel ÏÂÁîÐй¤¾ß¡£ÈôÊÇÄúÓöµ½Õâ¸öÎÊÌ⣬Çëƾ֤ÉÏÊö°ì·¨ÊµÑé½â¾ö¡£
ÒÔÉϾÍÊÇ×°ÖÃlaravel¿ò¼Ü·ºÆðcommandÔõô°ìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡