简体   繁体   English

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

[英]sh: 1: laravel: not found while laravel command works

I'm having trouble installing Laravel Spark. 我在安装Laravel Spark时遇到问题。 When I run spark new website I get the error sh: 1: laravel: not found . 当我运行spark new website ,出现错误sh: 1: laravel: not found I read on the internet that this problem is usually caused by incorrect configuration of $PATH but this is not the case for me. 我在互联网上读到,此问题通常是由于$PATH配置错误引起的,但对我而言并非如此。 I have composer global require laravel/installer and ~/.config/composer/vendor/bin has been added to my $PATH . 我有composer global require laravel/installer并且~/.config/composer/vendor/bin已添加到我的$PATH When I type laravel in the terminal it simply works and I can make new Laravel websites. 当我在终端中输入laravel时,它可以正常工作,并且我可以创建新的Laravel网站。

I've also cloned the laravel/spark-installer repo and added it to my path and typing spark in the terminal also works. 我还克隆了laravel/spark-installer库,并将其添加到我的路径中,并且在终端中输入spark也可以。

The output I'm getting when I'm trying to create a new spark website is the following: 尝试创建新的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)

Any ideas on what's wrong? 有什么问题的想法吗?

Thanks! 谢谢!

The PATH for Laravel should be: ~/.composer/vendor/laravel/installer" instead of ~/.config/composer/vendor/bin ... Laravel的路径应为: ~/.composer/vendor/laravel/installer"而不是~/.config/composer/vendor/bin ...

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

Close and start a new shell, and enter: $ laravel --version Laravel Installer 2.0.1 关闭并启动新的shell,然后输入: $ laravel --version Laravel Installer 2.0.1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM