简体   繁体   English

为什么每次将sag sva放入我的游民箱时都必须运行捆绑安装

[英]Why do I have to run bundle install every time I vagrant ssh into my vagrant box

I'm using a Vagrant file from late last year with a brand new rails project and for some reason, every time I vagrant ssh into the box, it can't find a certain gem and I have to run bundle install . 我正在使用来自去年下半年的Vagrant文​​件以及一个全新的Rails项目,由于某种原因,每当我将vagrant ssh放到盒子中时,它都找不到某个gem,因此我必须运行bundle install

Below is my Vagrantfile, any help would be appreciated. 下面是我的Vagrantfile,任何帮助将不胜感激。 Thanks! 谢谢!

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "eyefodder/precise64-utf8"
  config.vm.host_name = 'myproj'

  config.vm.network :forwarded_port, guest: 3000, host: 3000
  # config.vm.network :forwarded_port, id: 'ssh', guest: 22, host: 2222

  config.vm.synced_folder "./puppet", "/etc/puppet"
  config.vm.synced_folder 'dotfiles', '/dotfiles'
  config.vm.synced_folder '../reports', '/reports'
  config.vm.synced_folder "../", "/app", type: "rsync", rsync__exclude: [".git/", "ops/*", "reports/",  "tmp/", "log/", ".#*"]

  config.vm.provider 'virtualbox' do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
    vb.name = 'myproj'
  end

  config.vm.provision 'shell', path: 'install_apt_packages.sh'
  config.vm.provision 'shell', path: 'build_ruby_from_source.sh'
  config.vm.provision 'shell', path: 'install_puppet_modules.sh'
  config.vm.provision "puppet" do |puppet|
    puppet.module_path = 'puppet/modules'
    puppet.hiera_config_path = "puppet/hiera.yaml"
    puppet.working_directory = "/etc/puppet"
    puppet.environment_path = "puppet/environments"
    puppet.environment = "dev"
  end

  config.trigger.before [:up, :reload], :stdout => true do
    run "mkdir -p ../reports"
    run "mkdir -p ../public/uploads"
    run "sh ./setup_guest_bash_profile.sh"
  end
end

Edit 编辑

Also seems whenever I kill my rails server I have to run bundle install again in order to start it up or view a rails console 似乎每当我杀死Rails服务器时,都必须再次运行bundle install才能启动它或查看Rails控制台

rsync is a default type with the specific property rsync是具有特定属性的默认类型

The rsync synced folder does a one-time one-way sync from the machine running to the machine being started by Vagrant. rsync synced文件夹从运行的计算机到由Vagrant启动的计算机进行一次单向同步。

so the changes are not reflected (in somewhat) real time, you need to force your system to sync again the files 因此更改不会(实时)反映出来,您需要强制系统再次同步文件

make the change in your Vagrantfile 在您的Vagrantfile中进行更改

  config.vm.synced_folder "../", "/app", type: "rsync", rsync__exclude: [".git/", "ops/*", "reports/",  "tmp/", "log/", ".#*"], rsync_auto: true

and then after you have vagrant up you will need to run 然后当你vagrant up您将需要运行

$ vagrant rsync-auto

so vagrant will force rsync to sync your files when there's some change. 因此,发生变化时,vagrant将强制rsync同步文件。 Everything should work smoothly 一切都应该顺利进行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在重新格式化计算机后,为什么需要运行bundle install? - Why do I need to run bundle install after I reformatted my computer? 我必须将捆绑安装到tmux的每个窗格 - I have to `bundle install` to every pane of tmux 为什么每次打开新终端时都要安装Rails? - Why do I have to install Rails every time I open a new terminal? 如何在Windows 7上使用Vagrant访问我的Virtualbox - How do I access my Virtualbox using Vagrant on Windows 7 对无所事事的盒子运行rspec - Run rspec against vagrant box 为什么在“捆绑安装”时找不到我的宝石? - Why are my gems not found when I do 'bundle install'? 我在用铁轨安装每个捆绑包时遇到麻烦。 如何修复 - I have trouble every bundle install with my rails. How to fix it 当我有一个垃圾桶/弹簧垃圾桶时,为什么必须运行“ bundle exec spring”? - Why do I have to run “bundle exec spring” when I have a bin/spring binstub? 没有检查出''宝石(在主人身上)。 首先运行'bundle install'“每次运行rake db:migrate - Getting “'gem (at master) is not checked out. Run 'bundle install' first” every time I run rake db:migrate 流浪者工作流程-流浪者ssh,流浪者销毁,流浪者启动命令 - Vagrant Workflow - vagrant ssh, vagrant destroy, vagrant up commands
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM