Reputation: 922
I'm trying to expose my local server through ngrok. I'm using vagrant to run my project in my localserver so, I read that there is a plugin for vagrant and ngrok, "vagrant share". I already downloaded ngrok but when I run the command vagrant share, this is the result :
The executable 'ngrok' Vagrant is trying to run was not found in the PATH variable. The 'ngrok' executable is required to run Vagrant share. If 'ngrok' is currently installed in a non-standard location, append that location to the PATH variable and run this command again.
I already put ngrok in the environment variable but it doesn't work.
Any idea how to fix it? I have several days with this problem and I can't solve it.
Upvotes: 3
Views: 2638
Reputation: 101
In your $PATH provide only the path to where ngrok binary executable can be found. For example: /path/to
is correct , and not /path/to/ngrok
At least that was my mistake at first. Hope that detail helps to someone. In principle @learning2learn 's answer is correct.
Upvotes: 0
Reputation: 411
You have to explicitly have ngrok in your Windows PATH. I suspect the vagrant share
plugin does not install ngrok
.
To do this same thing for myself, I happened to be running with Visual Studio Code, using PowerShell as the Terminal. I downloaded ngrok in zip form from the ngrok web site, extracted, placed it in my Windows home directory, and added that to the PowerShell path. Then vagrant share
immediately worked (I did not have to explicitly setup an authtoken or connect an account). Below substitute windowsuser
with your account id.
c:\Users\windowsuser
$env:Path += ";c:\users\windowsuser"
PS C:\Users\windowsuser\vagrant_getting_started> ngrok
NAME:
ngrok - tunnel local ports to public URLs and inspect traffic
DESCRIPTION:
ngrok exposes local networked services behinds NATs and firewalls to the
public internet over a secure tunnel. Share local websites, build/test
webhook consumers and self-host personal services.
Detailed help for each command is available with 'ngrok help <command>'.
Open http://localhost:4040 for ngrok's web interface to inspect traffic.
EXAMPLES:
ngrok http 80 # secure public URL for port 80 web server
ngrok http -subdomain=baz 8080 # port 8080 available at baz.ngrok.io
ngrok http foo.dev:80 # tunnel to host:port instead of localhost
ngrok http https://localhost # expose a local https server
ngrok tcp 22 # tunnel arbitrary TCP traffic to port 22
ngrok tls -hostname=foo.com 443 # TLS traffic for foo.com to port 443
ngrok start foo bar baz # start tunnels from the configuration file
VERSION:
2.3.35
AUTHOR:
inconshreveable - <[email protected]>
COMMANDS:
authtoken save authtoken to configuration file
credits prints author and licensing information
http start an HTTP tunnel
start start tunnels by name from the configuration file
tcp start a TCP tunnel
tls start a TLS tunnel
update update ngrok to the latest version
version print the version string
help Shows a list of commands or help for one command
PS C:\Users\windowsuser\vagrant_getting_started>
vagrant share
should work; as you can see, I am working through the vagrant tutorials.PS C:\Users\windowsuser\vagrant_getting_started> vagrant share
==> default: Detecting network information for machine...
default: Local machine address: 127.0.0.1
default:
default: Note: With the local address (127.0.0.1), Vagrant Share can only
default: share any ports you have forwarded. Assign an IP or address to your
default: machine to expose all TCP ports. Consult the documentation
default: for your provider ('virtualbox') for more information.
default:
default: Local HTTP port: 4567
default: Local HTTPS port: disabled
default: Port: 2200
default: Port: 4567
==> default: Creating Vagrant Share session...
==> default: HTTP URL: http://e058e1d1b464.ngrok.io
==> default:
C:\Users\windowsuser>set PATH=%PATH%;C:\Users\windowsuser
Upvotes: 0
Reputation: 344
Have you tried installing the vagrant share
plugin manually?
vagrant plugin install vagrant-share
Upvotes: 0