'Zsh: command not found: valet' - unable to install Valet

时间:2017-08-05 12:12:18

标签: homebrew laravel-valet

I just tried installing valet for a very long time, - and I couldn't find any help anywhere. No matter what I tried, then it kept saying:

Zsh: command not found: valet

I'm running Zshell (instead of Bash) and OSX. I've had Brew installed for quite a while.

I'll answer this myself, - so hopefully people in the same situation can find this in the future.

3 个答案:

答案 0 :(得分:3)

在Zsh下,我有一个非常相似的问题,但是我的解决方案更容易。无需将public class AllModes { private final Supplier<Stream<Car>> cars; private final Supplier<Stream<Boat>> boats; public AllModes(Optional<Car> car, Optional<Boat> boat) { // Assuming Java 8, when Optional did not have a stream() method yet this.cars = () -> car.map(Stream::of).orElse(Stream.empty()); this.boats = () -> boat.map(Stream::of).orElse(Stream.empty()); } public AllModes(List<Car> cars, List<Boat> boats) { this.cars = cars::stream; this.boats = boats::stream; } public Stream<Car> getCars() { return cars.get(); } public Stream<Boat> getBoats() { return boats.get(); } } 添加到我的~/.composer/vendor/bin中,我需要使用完整的目录名;即$PATH

答案 1 :(得分:0)

Everywhere it says to 'Check that your path is right'. And yup - if you haven't done that, then you should start there. The easiest way is to go to your terminal and write:

echo $PATH

... And then you should see ~/.composer/vendor/bin in between two colons in there. If that isn't there, then you should go to your ~/.bashrc-file (or ~/.zshrc-file) and add this line:

export $PATH=~/.composer/vendor/bin:$PATH

And then it may be fixed.

My problem had deeper roots, though. Even though my path was right, then I still got the error:

Zsh: command not found: valet

And if I wrote: which valet - then it (obviously) just responded with valet not found.

Removal of Composer

What fixed it was to remove all my composer-installations. Composer can be located in several different locations (and installed by brew). So in order to remove it, then do this (inspired by this post, but it lacks a couple of steps):

  • Remove your composer- or -composer.phar-file. You can find them by running which composer and/or which composer.phar.
  • Remove your .composer-folder (usually located here: ~/.composer).
  • Then make sure that there isn't an installation done with Homebrew (this was what I think made the collision for me). You do it by running brew unlink composer followed by brew remove composer.
  • Then, - if you want to be 100% sure that it's all gone, then go to your root (cd /) and run this command: find ./* -name 'composer.phar' and this `find ./* -name 'composer'. That should tell you of all the locations where the Composer-installation can be installed.

When all that's removed, then you should be rid of Composer (entirely). ... Then install it again, - and see if you can get valet to work (it did for me).

答案 2 :(得分:0)

问题 Ubuntu:没有命令代客

Ubuntu 上的代客:

<块引用>

sudo apt install libnss3-tools jq xsel

composer global 需要 cpriego/valet-linux

.composer/vendor/cpriego/valet-linux/valet install

现在命令代客应该工作,但如果仍然没有:

<块引用>

sudo cp .composer/vendor/cpriego/valet-linux/valet /usr/local/bin/