sh:1:laravel:laravel命令工作时找不到

时间:2016-09-12 07:54:58

标签: php linux laravel path

我在安装Laravel Spark时遇到了问题。当我运行spark new website时,我收到错误sh: 1: laravel: not found。我在互联网上看到这个问题通常是由$PATH的错误配置引起的,但对我来说情况并非如此。我已将composer global require laravel/installer~/.config/composer/vendor/bin添加到我的$PATH。当我在终端中键入laravel时,它只是起作用,我可以创建新的Laravel网站。

我还克隆了laravel/spark-installer个回购并将其添加到我的路径中,并在终端中输入spark也可以。

当我尝试创建新的Spark网站时,我得到的输出如下:

git@staging:~$ spark new sparktest
sh: 1: laravel: not found
Downloading Spark...
PHP Warning:  file_put_contents(/home/git/sparktest/spark-archive.zip): failed to open stream: No such file or directory in /home/git/spark/src/Installation/DownloadSpark.php on line 59
PHP Warning:  ZipArchive::extractTo(): Invalid or uninitialized Zip object in /home/git/spark/src/Installation/DownloadSpark.php on line 105
PHP Warning:  ZipArchive::close(): Invalid or uninitialized Zip object in /home/git/spark/src/Installation/DownloadSpark.php on line 107
PHP Notice:  Undefined offset: 0 in /home/git/spark/src/Installation/DownloadSpark.php on line 120
PHP Warning:  file_get_contents(/home/git/sparktest/composer.json): failed to open stream: No such file or directory in /home/git/spark/src/Installation/UpdateComposerFile.php on line 54
Loading composer repositories with package information
Updating dependencies (including require-dev)

关于什么错误的任何想法?

谢谢!

1 个答案:

答案 0 :(得分:0)

Laravel的路径应为:~/.composer/vendor/laravel/installer"而不是~/.config/composer/vendor/bin ...

~./bash_profile添加一行,例如: export PATH="$PATH:~/.composer/vendor/laravel/installer"

关闭并启动新的shell,然后输入: $ laravel --version Laravel Installer 2.0.1