3
當運行vagrant provision,而不是在用戶環境中安裝ruby gem時,請安裝在root用戶環境中。Vagrant - 安裝Ruby Gems
這裏是我的無業遊民文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
# Optional NFS. Make sure to remove other synced_folder line too
#config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
config.vm.provision "shell", path: "provision/install.sh"
config.vm.provision "shell", path: "provision/install-gems.sh"
end
而且install-gems.sh:
#!/usr/bin/env bash
echo "- install sass ..."
gem install sass
echo "- install sass done"
echo "- install compass ..."
gem install compass
echo "- install compass done"
echo "- install bootstrap-sass ..."
gem install bootstrap-sass
echo "- install bootstrap-sass done"
當我運行gem list
,而不是出現在寶石,但是當我運行sudo gem list
,他們這樣做,我不想。
我如何在流浪漢中安裝gem而不是root模式?嘗試將privileged: false
添加到vagant文件中,但由於權限而無法工作。
謝謝!
這不行,因爲去sudo enviro而不是用戶環境。 – jvrdom