0
votes

I'm currently setting up a virtual machine to play host to a web development project I'm engaged in. To give some initial context as to the specifications of the items at play, I'm provisioning the Virtual Machine using Vagrant with the provider as VirtualBox. The host OS is Windows 10 (Build 14393.1066 if that's helpful) and the guest OS is Ubuntu 16.04.2 LTS. The VagrantFile sets up 2 additional synced folders (i.e: on top of the /vagrant one done automatically).

I decided for the first time (don't be too shocked), that I would begin using npm with my project due to several plugins I desired. One such plugin was gulp. I was going through the gulp Getting Started and tried to run npm install --save-dev gulp in my project directory (which is one of the synced folders). This produced (in part) the error npm ERR! syscall symlink.

This did not initially worry me as the issue is well documented online and seems to pertain to the irritating MAX_PATH business in Windows. I attempted the suggested fix, by adding the following code in my VagrantFile:

config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
end

between the Vagrant.configure("2") do |config| and end.

This did not work, however, which I assumed was down to the fact that it was perhaps just allowing symbolic links within the vagrant directory. I then attempted to add the symbolic link allowance by replacing vagrant with the path to the directory on the guest os (I've omitting the enclosing do and end for brevity):

    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/var/www", "1"]

When this didn't work, I tried adding the symbolic links capability to the synced folders location with the vagrant directory:

v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant/www", "1"]

Also to no avail. This issue is driving me bonkers, and was one I thought was fixed in VirtualBox as they appended synced folders host paths with the \\? business to indicate to Windows the path would exceed the MAX_PATH, though evidently not.

If anyone has a solution to this, I would be most grateful.

1

1 Answers

0
votes

So not long after asking this question, I closed my Bash terminal in error. When I went to re-open, the whole 'Run as Administrator' occurred to me and I opened Bash in this manner. I go back into the Virtual Machine and try running the desired command again and voila! It works.

In short, the solution seems to be running the Bash terminal that the VM is being accessed from in Administrator mode and adding

config.vm.provider "virtualbox" do |v|
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant/syncedfoldername", "1"]
end

into the VagrantFile is the way to go.