Laravel “valet install” not found

后端 未结 9 984
逝去的感伤
逝去的感伤 2020-12-13 09:49

I am trying to set up Laravels Valet (Valet is a Laravel development environment for Mac). Everything works until it comes to the command \"valet install\". This command mus

相关标签:
9条回答
  • 2020-12-13 09:57

    Yes, you need to make sure that ~/.composer/vendor/bin directory is in your system's PATH, you can check this by running:

    echo $PATH
    

    If you can't see it there, then you need to add this to your ~/.bash_profile:

    export PATH=$PATH:~/.composer/vendor/bin
    
    0 讨论(0)
  • 2020-12-13 10:00

    Add ~/.composer/vendor/bin directory to your PATH variable.

    0 讨论(0)
  • 2020-12-13 10:01

    If you have a fresh installation, you may not have the PATH variable contains your home path. So, adding the $HOME variable would require like the following:

    export PATH="$PATH:$HOME/.composer/vendor/bin

    0 讨论(0)
  • 2020-12-13 10:02

    In Ubuntu 18.04 do this:

    echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc
    source ~/.bashrc
    
    0 讨论(0)
  • 2020-12-13 10:08

    If you're getting the error message "valet: command not found", it's likely that PHP's Composer is not in your PATH variable, for instance:

    $ valet install
    -bash: valet: command not found
    

    You can confirm if Laravel Valet was successfully installed by running the following command:

    ls -al ~/.composer/vendor/bin/valet
    

    If successfull, you'll see the symlink for Valet in Composer's bin directory pointing to Laravel in the vendor directory:

    ~/.composer/vendor/bin/valet@ -> ../laravel/valet/valet
    

    To test whether your PATH is missing Composer, try running the Valet command directly:

    ~/.composer/vendor/bin/valet --version
    

    If you're shown the Laravel version number, (e.g. Laravel Valet 2.0.4), this indicates Valet is installed but you need to update your PATH variable to include Composer for the valet command to work globally.

    In your Terminal, execute the following command which will append Composer to your shell's PATH:

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

    For the changes to take effect, you'll need to exit and re-open your Terminal window or tab.

    Alternatively, you can simply source your shell's profile, which doesn't require quitting your active session:

    source ~/.bash_profile
    

    If you have a different shell environment or you're using a shell other than Bash, you will need to source its configuration profile instead (e.g. .bashrc, .zshrc, config.fish).

    0 讨论(0)
  • 2020-12-13 10:08

    I'm using oh-my-zsh so:

    echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.zshrc
    source ~/.zshrc
    

    You may replace .zshrc with .bashrc

    0 讨论(0)
提交回复
热议问题