Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlexis Donnard
4,931 PointsVagrant cannot forward the specified port on this VM
Hi, After installing Ruby, I ran the 'rails new testapp' command and went to my localhost:3000 and this worked perfectly. However, now that I want to install the VM Treehouse, when I run the 'vagrant up' command, I got the following error message:
Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 3000 is already in use on the host machine.
To fix this, modify your current projects Vagrantfile to use another port. Example, where '1234' would be replaced by a unique host port:
config.vm.network :forwarded_port, guest: 3000, host: 1234
Sometimes, Vagrant will attempt to auto-correct this for you. In this case, Vagrant was unable to. This is usually because the guest machine is in a state which doesn't allow modifying port forwarding.
Do you know how I can fix this?
Thanks in advance.
Alexis
Alexis Donnard
4,931 PointsAlexis Donnard
4,931 PointsOk so I found the answer if someone encounters the same pb: Just go to your 'projects' folder and open the VagrantFile. You'll get a line with: config.vm.network :forwarded_port, guest: 1234, host: 1234, and you only need to change the guest and host nb :)