laravel is not recognized as an internal or external command

人走茶凉 提交于 2019-12-20 09:48:44

问题


I'm trying to start laravel,

Found the following line in their tutorial:

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 don't understand what I should do ?

I added ~/.composer/vendor/bin to my system variables, and then tried using 'laravel new blog' in the command line but got the following message :

laravel is not recognized as an internal or external command

what should I do?


回答1:


For Windows add

C:\Users\MyUserName\AppData\Roaming\Composer\vendor\bin 

... to directory by going to "My Computer" > "Properties" > "Advanced" > "Environment > Variables" > "Path".

Note: MyUserName is your pc username .

Restart your PC and it would work




回答2:


Use correct path to the Composer bin directory.

Good:

%USERPROFILE%\AppData\Roaming\Composer\vendor\bin

Bad:

~/.composer/vendor/bin



回答3:


For me after adding PATH to environment variables result was the same. I found me answer here

So at first you have to run in cmd

composer global require "laravel/installer=~1.1"

and then the message appears

" Changing directory to C:\Users\USER\AppData\Roaming\Composer\vendor\bin "

and after that you can run your command. For example

laravel new blog



回答4:


You need to install Laravel using

composer global require laravel/installer

Otherwise, even adding it to PATH won't help.



来源:https://stackoverflow.com/questions/25528583/laravel-is-not-recognized-as-an-internal-or-external-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!