简体   繁体   English

在流浪者上的源.bashrc

[英]source .bashrc on vagrant

I needed to modify .bashrc to set node path file on vagrant and I guess made a mistake. 我需要修改.bashrc以在vagrant上设置节点路径文件,我想这是一个错误。 I sourced it and my vagrant became paralyzed. 我找到了它,我的流浪汉瘫痪了。 I'm trying to fix the .bashrc but now vagrant can't run any normal linux commands like vi or cd. 我正在尝试修复.bashrc,但是现在流浪汉无法运行任何正常的Linux命令,例如vi或cd。 How can I modify .bashrc without destroying the box? 如何在不破坏盒子的情况下修改.bashrc? When I ssh to vagrant I get this 当我SSH无业游民时我得到这个

/usr/bin/which: no virtualenvwrapper.sh in (/home/vagrant/node_modules)
-bash: source: filename argument required
source: usage: source filename [arguments]
-bash: awk: command not found
-bash: awk: command not found

My setup is centos vagrant box on Mac. 我的设置是Mac上的centos vagrant box。

If you just need to modify a file on your Vagrant machine, I recommended using Vagrant's file provisioner . 如果您只需要修改Vagrant机器上的文件,则建议使用Vagrant的文件供应器 If your provisioning needs are more complex, then you should consider other provisioners such as Puppet or Chef. 如果您的配置需求更加复杂,则应考虑其他供应商,例如Puppet或Chef。

Solved it. 解决了。 I modified the Vagrant file to enable virtualbox gui. 我修改了Vagrant文​​件以启用virtualbox gui。

config.vm.provider "virtualbox" do |v|
  v.memory = 6144
  v.cpus = 4
  v.gui = true
end

Then in the virtualbox terminal that popped up, I logged in as root. 然后在弹出的virtualbox终端中,我以root用户身份登录。 The root user wasn't paralyzed like vagrant user was. 根用户没有像无业游民的用户那样瘫痪。 I then opened the vagrant's user .bashrc file by going to /home/vagrant/ deleted the line that was causing issue. 然后,我通过转到/home/vagrant/删除了引起问题的行,来打开流浪者的用户.bashrc文件。 Exited root and logged in as vagrant and everything started to work normally 退出root并以流浪汉身份登录,一切开始正常工作

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM