Closed golfhotel closed 8 years ago
Personally, I just CD to the directories on the host machine (in my case OSX's terminal) and then use npm install
or grunt
or composer
or git
or really anything there. The only time I ever run directly in the VM is xdebug_on
and xdbug_off
.
Your workflow does not work on my host machine (windows).
Do you use Git
, Grunt
(etc ...) inside the VM or use these programs installed on your local machine? Thanks @Shelob9
@golfhotel I have them installed on my parent machine. I have no experience doing this with Windows, but I know it should work. If not, you can always enter the Vagrant machine with vagrant ssh
My interest is to understand if it's possible to launch the command of these programs (installed in the VM) from the host machine without the use of the vagrant ssh
command.
Me too mentioned programs work correctly if installed on the host machine. At this point, what sense does it to have Git or Grunt on the VM? Thanks anyway @Shelob9.
You should be able to use these tools in some respect on your machine within the VM.
Here are a few links to get started: https://getcomposer.org http://git-scm.com https://nodejs.org https://www.npmjs.com https://www.npmjs.com/package/grunt
I am not sure if some of these tools can be used locally on Windows, though.
I use Grunt and git locally on my PC. Both are really easy to install. I found installing Composer with PHP a bit more complicated and I don't use composer that often. To install something using Composer I normally SSH into the VM and run the command from there. For doing that I use Putty.
Git and Grunt are needed on the VM to run a few commands when provisioning the setup.
@golfhotel Workflows can definitely vary, but all of these tools are accessible in the VM as if it was a server you were working on. If it makes sense to use them there because of the hurdles involved with installing them locally, there should be no issue.
Because of the way Virtuabox manages shared drives, it's possible that some Grunt processes run from the VM will take longer. If Grunt is a regular part of your workflow, then it may be worth looking into a workflow that involves running it locally. This is definitely a YMMV moment though.
I'm currently using another Vagrant setup by Jeffery Way(laracasts.com) that uses config.vm.synced_folder. Which appears to be a simple file watcher that syncs changes on the host to the VM immediately. Different than Shared Folders. IMO this is the solve for the OP's problem(and mine) of not wanting to be required to interact with the files inside the VM. Is this implemented in any way in VVV? It doesn't appear to be.
I use PHPStorm, Git, Composer, Gulp, Grunt, Bower, NPM, etc. installed in my host to work on files in my host filesystem and the changes are synced to the VM just as if I was on the VM making the changes. I really like this workflow because the only thing I need to do in the VM is create an apache.conf for each vhost, add them in the hosts file and restart apache. Don't have to interact with the VM for anything other than that.
The problem I come across often is running Grunt locally often fails because of conflicting versions of node modules. For instance, when I provision, the packages for "wordpress-develop" installed match the version of the host (Ubuntu, running Node v0.10.37 in this case). When I try to run Grunt from my host (OS X, running a different version of Node), it throws an error about "libsass
bindings not found" because the node-sass
package installs scripts that match the host (which was Ubuntu, not OS X). The only solution for this is to remove the node_modules directory, and run npm install
from OS X.
This works great, right up to the point I want to run unit tests. They fail to run because the database is set to run inside the VM, not on my host. The only way to run them is inside a Vagrant shell.
One trick I use, is the vagrant ssh -c
command, which lets me run a command from inside vagrant without having to completely shell into it, so running the default grunt task is a single command:
vagrant ssh -c "cd /srv/www/wordpress-develop/ && grunt"
This saves me from managing node dependencies, and always ensures I'm using the modules that are installed during a provision.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
What would be the best out-of-the-box method to use the systems installed through the provisioning of VVV? I refer to systems such as Git, Grunt and Composer. Can I manage them from the local machine or I must access to the CLI of virtual machine?
For example, to launch npm install or grunt command, I must navigate to the project's root folder inside the virtual machine?
I found a similar discussion a bit dated here: https://github.com/Varying-Vagrant-Vagrants/VVV/issues/141 but it was not helpful.
Thanks to those who can help me and congratulations for the project VVV. Exciting !!!