获取未定义索引:REQUEST_URI - 在Laravel中运行Artisan命令时

I keep getting the error below every time I try to run an artisan command on Laravel, I'm on the project directory.

For example, I run this command:

php artisan make:migration create_stats_table

And I get this error:

  [ErrorException]              
  Undefined index: REQUEST_URI

No matter what command I run, I get the same error, even php artisan --version returns this error. How can I solve this problem?

Your code expects to have this index, but you're running PHP in CLI mode. REQUEST_URI variable of $_SERVER superglobal is only available if you're reaching script by browser.