Skip to content

Instantly share code, notes, and snippets.

@merlinstardust
Created March 10, 2016 16:36
Show Gist options
  • Save merlinstardust/34d32cb861c608a1d50e to your computer and use it in GitHub Desktop.
Save merlinstardust/34d32cb861c608a1d50e to your computer and use it in GitHub Desktop.
Mounts Node node_modules directories within Vagrant so apps can run
config.vm.provision "node_modules mounting", type: "shell", run: "always" do |shell|
shell.privileged = false
shell.args = "'#{app_name}'"
shell.inline = <<-SHELL
echo "Mounting node_modules directories"
for directory in /$1/*; do
if [ -f $directory/package.json ]; then
mkdir -p $directory/node_modules
mkdir -p /home/vagrant$directory/node_modules
sudo mount --bind /home/vagrant$directory/node_modules $directory/node_modules
fi
done
echo "Directories created"
SHELL
end
@mfissehaye
Copy link

What's '#{app_name}'
I am getting an error undefined local variable or method 'app_name'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment