laravel 不被识别为内部或外部命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25528583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel is not recognized as an internal or external command
提问by darroosh
I'm trying to start laravel,
我正在尝试启动 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.
确保将 ~/.composer/vendor/bin 目录放在 PATH 中,以便在终端中运行 laravel 命令时找到 laravel 可执行文件。
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 :
我添加~/.composer/vendor/bin
到我的系统变量中,然后尝试在命令行中使用“laravel new blog”,但收到以下消息:
laravel is not recognized as an internal or external command
laravel is not recognized as an internal or external command
what should I do?
我该怎么办?
回答by Mantas D
Use correct path to the Composer bin
directory.
使用 Composerbin
目录的正确路径。
Good:
好的:
%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
Bad:
坏的:
~/.composer/vendor/bin
回答by Alireza Aboutalebi
For Windows add
对于 Windows 添加
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 .
注意:MyUserName 是您的电脑用户名。
Restart your PC and it would work
重新启动你的电脑,它会工作
回答by gsiradze
For me after adding PATH to environment variables result was the same. I found me answer here
对我来说,将 PATH 添加到环境变量后结果是一样的。我在这里找到了答案
So at first you have to run in cmd
所以首先你必须在cmd中运行
composer global require "laravel/installer=~1.1"
and then the message appears
然后出现消息
" Changing directory to C:\Users\USER\AppData\Roaming\Composer\vendor\bin "
" 将目录更改为 C:\Users\USER\AppData\Roaming\Composer\vendor\bin "
and after that you can run your command. For example
之后你可以运行你的命令。例如
laravel new blog
回答by CaptainMike
You need to install Laravel using
您需要使用安装 Laravel
composer global require laravel/installer
Otherwise, even adding it to PATH won't help.
否则,即使将其添加到 PATH 也无济于事。
回答by Emmanuel Adebayo
First, use:
首先,使用:
composer global require "laravel/installer=~1.1"
Then, you can try again.
然后,您可以再试一次。
laravel new project