Homestead: "share" command not found

Created on 4 Jun 2017  Â·  13Comments  Â·  Source: laravel/homestead

Hello,

Trying to share my homestead box for a test and it can't find the share command.
I've updated to the latest version of homestead and provisioned the box again.
Any help would be greatly appreciated. Thank you.

Versions

  • Vagrant: 1.9.5
  • Provider: Virtualbox 5.1.22 r115126
  • Homestead: I get an error running php bin/homestead. Can't tell you.

Host operating system

macOS Sierra

Homestead.yaml

---
ip: "192.168.10.10"
memory: 4000
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Sites/homestead
      to: /home/vagrant/Code

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

blackfire:
    - id: 
      token: 
      client-id: 
      client-token:

ports:
     - send: 9200
       to: 9200
     - send: 27017
       to: 27017
     - send: 28017
       to: 28017
#     - send: 7777
#       to: 777
#       protocol: udp

sites:
    - map: ruvix2.app
      to: /home/vagrant/Code/ruvix2/public

Most helpful comment

Sounds like you need to run the sh init.sh script, or php vendor/bin/homestead make depending on how you're using Homestead.

All 13 comments

From inside the Vagrant machine please post the contents of the file /home/vagrant/.bash_aliases as well as the aliases file from your Homestead folder or Project root.

There is no .bash_aliases file in any of the locations mentioned by you.

Sounds like you need to run the sh init.sh script, or php vendor/bin/homestead make depending on how you're using Homestead.

Did that and reprovisioned the machine. Now it says it can't find ngrok when I run the share command.

Try running vagrant box update to make sure you are getting the most up to date version of the base box.

It was already at the latest version.

Box 'laravel/homestead' (v2.1.0) is running the latest version.

ngrok is baked into the base box. You should see it:

vagrant@homestead:~$ whereis ngrok
ngrok: /usr/local/bin/ngrok

If you see it there, and you still get errors using share, something has altered your aliases file and I would need to see the contents to debug any further. The /usr/local/bin should be in the user's path so running ngrok should return the default output.

Please paste the entire output of the following commands: ngrok and the share command you are using.

Hey,

whereis just says

ngrok:

Running ngrok says

-bash: ngrok: command not found

It just seems that it isn't installed. As i said before this message, after I ran init.sh and reprovisioned the machine the share command was there but couldn't find ngrok.

vagrant@homestead:~$ share ruvix2.app
-bash: ngrok: command not found

Do a vagrant destroy. Not just a provision. Also do rm .vagrant in the folder you run vagrant commands from. This will force vagrant to copy a new copy of the base box to the project folder.

--

  • Joe Ferguson
    JoeFerguson.me
    MemphisPHP.org

On Jun 5, 2017, 07:40 -0500, Neamtu Andrei notifications@github.com, wrote:

Hey,
whereis just says
ngrok:
Running ngrok says
-bash: ngrok: command not found
It just seems that it isn't installed. As i said before this message, after I ran init.sh and reprovisioned the machine the share command was there but couldn't find ngrok.
vagrant@homestead:~$ share ruvix2.app
-bash: ngrok: command not found
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Did that, removed all the homestead boxes I had and set it up again. Share now works.
Thank you.

This didn't work for me. Followed all the steps, I'm on the latest 2.1.0 version (even removed ~/Homestead/.vagrant) and still no share command:

vagrant ssh
Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-66-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

158 packages can be updated.
58 updates are security updates.


Last login: Tue Jun 20 02:55:20 2017 from 10.0.2.2
vagrant@homestead:~$ cat /home/vagrant/.bash_aliases
alias ..="cd .."
alias ...="cd ../.."

alias h='cd ~'
alias c='clear'
alias art=artisan

alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
alias serve=serve-laravel

function serve-laravel() {
    if [[ "$1" && "$2" ]]
    then
        sudo dos2unix /vagrant/scripts/serve-laravel.sh
        sudo bash /vagrant/scripts/serve-laravel.sh "$1" "$2" 80
    else
        echo "Error: missing required parameters."
        echo "Usage: "
        echo "  serve domain path"
    fi
}

function serve-hhvm() {
    if [[ "$1" && "$2" ]]
    then
        sudo dos2unix /vagrant/scripts/serve-hhvm.sh
        sudo bash /vagrant/scripts/serve-hhvm.sh "$1" "$2" 80
    else
        echo "Error: missing required parameters."
        echo "Usage: "
        echo "  serve-hhvm domain path"
    fi
}

function serve-proxy() {
    if [[ "$1" && "$2" ]]
    then
        sudo dos2unix /vagrant/scripts/serve-proxy.sh
        sudo bash /vagrant/scripts/serve-proxy.sh "$1" "$2" 80
    else
        echo "Error: missing required parameters."
        echo "Usage: "
        echo "  serve-proxy domain port"
    fi
}

function serve-apache() {
    if [[ "$1" && "$2" ]]
    then
        sudo dos2unix /vagrant/scripts/serve-apache.sh
        sudo bash /vagrant/scripts/serve-apache.sh "$1" "$2" 80
    else
        echo "Error: missing required parameters."
        echo "Usage: "
        echo "  serve-apache domain path"
    fi
}

function artisan() {
    php artisan "$@"
}

ngrok is installed though:

$ whereis ngrok
ngrok: /usr/local/bin/ngrok

Is there a place I can download a new /home/vagrant/.bash_aliases or use ngrok directly?

Thanks!

@zmorris Your aliases file is missing the share alias. Delete it and then run the init script (or homestead make command depending on your install method).

Thank you, after posting this I reread everything and noticed that aliases was stale because I'm trying to upgrade to the newest Homestead. For anyone who is upgrading and finds this, read this Laravel Homestead upgrade process from:

https://davejustdave.com/2016/03/08/how-to-upgrade-laravel-homestead-vagrant-box/

Except pull the newest Homestead master before you start (assuming you originally installed with git clone https://github.com/laravel/homestead.git Homestead):

cd ~/Homestead
git pull
# run init.sh but DO NOT OVERWRITE YOUR Homestead.yaml
sh init.sh
vagrant up --provision
...

This worked for me, and now I'm seeing this output and the site works:

$ share mysite.app
ngrok by @inconshreveable                                                                                                                                                                                                                                     (Ctrl+C to quit)

Session Status                online                                                                                                                                                                                                                                          
Update                        update available (version 2.2.4, Ctrl-U to update)                                                                                                                                                                                              
Version                       2.2.3                                                                                                                                                                                                                                           
Region                        United States (us)                                                                                                                                                                                                                              
Web Interface                 http://127.0.0.1:4040                                                                                                                                                                                                                           
Forwarding                    http://XXXXXXXX.ngrok.io -> localhost:80                                                                                                                                                                                                        
Forwarding                    https://XXXXXXXX.ngrok.io -> localhost:80                                                                                                                                                                                                       

Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                                                                                                     
                              1       0       0.00    0.00    65.92   65.92                                                                                                                                                                                                   

HTTP Requests                                                                                                                                                                                                                                                                 
-------------                                                                                                                                                                                                                                                                 

GET /favicon.ico               404 Not Found                                                                                                                                                                                                                                  
GET /                          401 Unauthorized

Hope this helps someone, and thanks again.

Was this page helpful?
0 / 5 - 0 ratings