0

我在使用 virtualbox、minikube 和 node 时遇到了一个非常奇怪的情况。

这是情况。我正在使用 virtualbox 驱动程序运行 minikube,并且我正在minikube ip使用“child_process.exec”从内部节点调用。

exec('minikube ip', (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
});

当我这样做时,我会得到这个输出。

stderr: exec error: Error: Command failed: minikube ip
Found binary path at /usr/local/bin/minikube
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:59431
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minikube) Calling .GetIP
(minikube) DBG | COMMAND: /usr/local/bin/VBoxManage showvminfo minikube --machinereadable
(minikube) DBG | STDOUT:
(minikube) DBG | {
(minikube) DBG | }
(minikube) DBG | STDERR:
(minikube) DBG | {
(minikube) DBG | VBoxManage: error: Could not find a registered machine named 'minikube'
(minikube) DBG | VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
(minikube) DBG | VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2780 of file VBoxManageInfo.cpp
(minikube) DBG | }
E0301 08:44:20.777956   59415 ip.go:44] Error getting IP:  machine does not exist

但是,如果我minikube ip从终端运行它工作正常

Found binary path at /usr/local/bin/minikube
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:59573
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minikube) Calling .GetIP
(minikube) DBG | COMMAND: /usr/local/bin/VBoxManage showvminfo minikube --machinereadable
(minikube) DBG | STDOUT:
(minikube) DBG | {
(minikube) DBG | name="minikube"
(minikube) DBG | groups="/"
(minikube) DBG | ostype="Linux 2.6 / 3.x / 4.x (64-bit)"
(minikube) DBG | UUID="1b33cdcc-277b-41bb-95d6-6265b049e201"
(minikube) DBG | CfgFile="/Users/namedev/.minikube/machines/minikube/minikube/minikube.vbox"
(minikube) DBG | SnapFldr="/Users/namedev/.minikube/machines/minikube/minikube/Snapshots"
(minikube) DBG | LogFldr="/Users/namedev/.minikube/machines/minikube/minikube/Logs"
(minikube) DBG | hardwareuuid="1b33cdcc-277b-41bb-95d6-6265b049e201"
(minikube) DBG | memory=8192
(minikube) DBG | pagefusion="off"
(minikube) DBG | vram=8
(minikube) DBG | cpuexecutioncap=100
(minikube) DBG | hpet="on"
(minikube) DBG | chipset="piix3"
(minikube) DBG | firmware="BIOS"
(minikube) DBG | cpus=2
(minikube) DBG | pae="on"
(minikube) DBG | longmode="on"
(minikube) DBG | triplefaultreset="off"
(minikube) DBG | apic="on"
(minikube) DBG | x2apic="off"
(minikube) DBG | cpuid-portability-level=0
(minikube) DBG | bootmenu="disabled"
(minikube) DBG | boot1="dvd"
(minikube) DBG | boot2="dvd"
(minikube) DBG | boot3="disk"
(minikube) DBG | boot4="none"
(minikube) DBG | acpi="on"
(minikube) DBG | ioapic="on"
(minikube) DBG | biosapic="apic"
(minikube) DBG | biossystemtimeoffset=0
(minikube) DBG | rtcuseutc="on"
(minikube) DBG | hwvirtex="on"
(minikube) DBG | nestedpaging="on"
(minikube) DBG | largepages="on"
(minikube) DBG | vtxvpid="on"
(minikube) DBG | vtxux="on"
(minikube) DBG | paravirtprovider="default"
(minikube) DBG | effparavirtprovider="kvm"
(minikube) DBG | VMState="running"
(minikube) DBG | VMStateChangeTime="2017-03-01T00:18:25.490000000"
(minikube) DBG | monitorcount=1
(minikube) DBG | accelerate3d="off"
(minikube) DBG | accelerate2dvideo="off"
(minikube) DBG | teleporterenabled="off"
(minikube) DBG | teleporterport=0
(minikube) DBG | teleporteraddress=""
(minikube) DBG | teleporterpassword=""
(minikube) DBG | tracing-enabled="off"
(minikube) DBG | tracing-allow-vm-access="off"
(minikube) DBG | tracing-config=""
(minikube) DBG | autostart-enabled="off"
(minikube) DBG | autostart-delay=0
(minikube) DBG | defaultfrontend=""
(minikube) DBG | storagecontrollername0="SATA"
(minikube) DBG | storagecontrollertype0="IntelAhci"
(minikube) DBG | storagecontrollerinstance0="0"
(minikube) DBG | storagecontrollermaxportcount0="30"
(minikube) DBG | storagecontrollerportcount0="30"
(minikube) DBG | storagecontrollerbootable0="on"
(minikube) DBG | "SATA-0-0"="/Users/namedev/.minikube/machines/minikube/boot2docker.iso"
(minikube) DBG | "SATA-ImageUUID-0-0"="977e41e5-d157-4fe3-8215-7d475ad7b32f"
(minikube) DBG | "SATA-tempeject"="off"
(minikube) DBG | "SATA-IsEjected"="off"
(minikube) DBG | "SATA-1-0"="/Users/namedev/.minikube/machines/minikube/disk.vmdk"
(minikube) DBG | "SATA-ImageUUID-1-0"="828a95e8-f149-46ca-bee5-f298ec6a444c"
(minikube) DBG | "SATA-2-0"="none"
(minikube) DBG | "SATA-3-0"="none"
(minikube) DBG | "SATA-4-0"="none"
(minikube) DBG | "SATA-5-0"="none"
(minikube) DBG | "SATA-6-0"="none"
(minikube) DBG | "SATA-7-0"="none"
(minikube) DBG | "SATA-8-0"="none"
(minikube) DBG | "SATA-9-0"="none"
(minikube) DBG | "SATA-10-0"="none"
(minikube) DBG | "SATA-11-0"="none"
(minikube) DBG | "SATA-12-0"="none"
(minikube) DBG | "SATA-13-0"="none"
(minikube) DBG | "SATA-14-0"="none"
(minikube) DBG | "SATA-15-0"="none"
(minikube) DBG | "SATA-16-0"="none"
(minikube) DBG | "SATA-17-0"="none"
(minikube) DBG | "SATA-18-0"="none"
(minikube) DBG | "SATA-19-0"="none"
(minikube) DBG | "SATA-20-0"="none"
(minikube) DBG | "SATA-21-0"="none"
(minikube) DBG | "SATA-22-0"="none"
(minikube) DBG | "SATA-23-0"="none"
(minikube) DBG | "SATA-24-0"="none"
(minikube) DBG | "SATA-25-0"="none"
(minikube) DBG | "SATA-26-0"="none"
(minikube) DBG | "SATA-27-0"="none"
(minikube) DBG | "SATA-28-0"="none"
(minikube) DBG | "SATA-29-0"="none"
(minikube) DBG | natnet1="nat"
(minikube) DBG | macaddress1="0800276B97F7"
(minikube) DBG | cableconnected1="on"
(minikube) DBG | nic1="nat"
(minikube) DBG | nictype1="82540EM"
(minikube) DBG | nicspeed1="0"
(minikube) DBG | mtu="0"
(minikube) DBG | sockSnd="64"
(minikube) DBG | sockRcv="64"
(minikube) DBG | tcpWndSnd="64"
(minikube) DBG | tcpWndRcv="64"
(minikube) DBG | Forwarding(0)="ssh,tcp,127.0.0.1,53964,,22"
(minikube) DBG | hostonlyadapter2="vboxnet1"
(minikube) DBG | macaddress2="08002721BF68"
(minikube) DBG | cableconnected2="on"
(minikube) DBG | nic2="hostonly"
(minikube) DBG | nictype2="82540EM"
(minikube) DBG | nicspeed2="0"
(minikube) DBG | nic3="none"
(minikube) DBG | nic4="none"
(minikube) DBG | nic5="none"
(minikube) DBG | nic6="none"
(minikube) DBG | nic7="none"
(minikube) DBG | nic8="none"
(minikube) DBG | hidpointing="ps2mouse"
(minikube) DBG | hidkeyboard="ps2kbd"
(minikube) DBG | uart1="off"
(minikube) DBG | uart2="off"
(minikube) DBG | uart3="off"
(minikube) DBG | uart4="off"
(minikube) DBG | lpt1="off"
(minikube) DBG | lpt2="off"
(minikube) DBG | audio="coreaudio"
(minikube) DBG | clipboard="disabled"
(minikube) DBG | draganddrop="disabled"
(minikube) DBG | SessionName="headless"
(minikube) DBG | VideoMode="720,400,0"@0,0 1
(minikube) DBG | vrde="off"
(minikube) DBG | usb="off"
(minikube) DBG | ehci="off"
(minikube) DBG | xhci="off"
(minikube) DBG | SharedFolderNameMachineMapping1="Users"
(minikube) DBG | SharedFolderPathMachineMapping1="/Users"
(minikube) DBG | VRDEActiveConnection="off"
(minikube) DBG | VRDEClients=0
(minikube) DBG | vcpenabled="off"
(minikube) DBG | vcpscreens=0
(minikube) DBG | vcpfile="/Users/namedev/.minikube/machines/minikube/minikube/minikube.webm"
(minikube) DBG | vcpwidth=1024
(minikube) DBG | vcpheight=768
(minikube) DBG | vcprate=512
(minikube) DBG | vcpfps=25
(minikube) DBG | GuestMemoryBalloon=0
(minikube) DBG | GuestOSType="Linux26_64"
(minikube) DBG | GuestAdditionsRunLevel=2
(minikube) DBG | GuestAdditionsVersion="5.1.6 r110634"
(minikube) DBG | GuestAdditionsFacility_VirtualBox Base Driver=50,1488327525999
(minikube) DBG | GuestAdditionsFacility_VirtualBox System Service=50,1488327526490
(minikube) DBG | GuestAdditionsFacility_Seamless Mode=0,1488327525997
(minikube) DBG | GuestAdditionsFacility_Graphics Mode=0,1488327525997
(minikube) DBG | }
(minikube) DBG | STDERR:
(minikube) DBG | {
(minikube) DBG | }
(minikube) DBG | COMMAND: /usr/local/bin/VBoxManage showvminfo minikube --machinereadable
(minikube) DBG | STDOUT:
(minikube) DBG | {
(minikube) DBG | name="minikube"
(minikube) DBG | groups="/"
(minikube) DBG | ostype="Linux 2.6 / 3.x / 4.x (64-bit)"
(minikube) DBG | UUID="1b33cdcc-277b-41bb-95d6-6265b049e201"
(minikube) DBG | CfgFile="/Users/namedev/.minikube/machines/minikube/minikube/minikube.vbox"
(minikube) DBG | SnapFldr="/Users/namedev/.minikube/machines/minikube/minikube/Snapshots"
(minikube) DBG | LogFldr="/Users/namedev/.minikube/machines/minikube/minikube/Logs"
(minikube) DBG | hardwareuuid="1b33cdcc-277b-41bb-95d6-6265b049e201"
(minikube) DBG | memory=8192
(minikube) DBG | pagefusion="off"
(minikube) DBG | vram=8
(minikube) DBG | cpuexecutioncap=100
(minikube) DBG | hpet="on"
(minikube) DBG | chipset="piix3"
(minikube) DBG | firmware="BIOS"
(minikube) DBG | cpus=2
(minikube) DBG | pae="on"
(minikube) DBG | longmode="on"
(minikube) DBG | triplefaultreset="off"
(minikube) DBG | apic="on"
(minikube) DBG | x2apic="off"
(minikube) DBG | cpuid-portability-level=0
(minikube) DBG | bootmenu="disabled"
(minikube) DBG | boot1="dvd"
(minikube) DBG | boot2="dvd"
(minikube) DBG | boot3="disk"
(minikube) DBG | boot4="none"
(minikube) DBG | acpi="on"
(minikube) DBG | ioapic="on"
(minikube) DBG | biosapic="apic"
(minikube) DBG | biossystemtimeoffset=0
(minikube) DBG | rtcuseutc="on"
(minikube) DBG | hwvirtex="on"
(minikube) DBG | nestedpaging="on"
(minikube) DBG | largepages="on"
(minikube) DBG | vtxvpid="on"
(minikube) DBG | vtxux="on"
(minikube) DBG | paravirtprovider="default"
(minikube) DBG | effparavirtprovider="kvm"
(minikube) DBG | VMState="running"
(minikube) DBG | VMStateChangeTime="2017-03-01T00:18:25.490000000"
(minikube) DBG | monitorcount=1
(minikube) DBG | accelerate3d="off"
(minikube) DBG | accelerate2dvideo="off"
(minikube) DBG | teleporterenabled="off"
(minikube) DBG | teleporterport=0
(minikube) DBG | teleporteraddress=""
(minikube) DBG | teleporterpassword=""
(minikube) DBG | tracing-enabled="off"
(minikube) DBG | tracing-allow-vm-access="off"
(minikube) DBG | tracing-config=""
(minikube) DBG | autostart-enabled="off"
(minikube) DBG | autostart-delay=0
(minikube) DBG | defaultfrontend=""
(minikube) DBG | storagecontrollername0="SATA"
(minikube) DBG | storagecontrollertype0="IntelAhci"
(minikube) DBG | storagecontrollerinstance0="0"
(minikube) DBG | storagecontrollermaxportcount0="30"
(minikube) DBG | storagecontrollerportcount0="30"
(minikube) DBG | storagecontrollerbootable0="on"
(minikube) DBG | "SATA-0-0"="/Users/namedev/.minikube/machines/minikube/boot2docker.iso"
(minikube) DBG | "SATA-ImageUUID-0-0"="977e41e5-d157-4fe3-8215-7d475ad7b32f"
(minikube) DBG | "SATA-tempeject"="off"
(minikube) DBG | "SATA-IsEjected"="off"
(minikube) DBG | "SATA-1-0"="/Users/namedev/.minikube/machines/minikube/disk.vmdk"
(minikube) DBG | "SATA-ImageUUID-1-0"="828a95e8-f149-46ca-bee5-f298ec6a444c"
(minikube) DBG | "SATA-2-0"="none"
(minikube) DBG | "SATA-3-0"="none"
(minikube) DBG | "SATA-4-0"="none"
(minikube) DBG | "SATA-5-0"="none"
(minikube) DBG | "SATA-6-0"="none"
(minikube) DBG | "SATA-7-0"="none"
(minikube) DBG | "SATA-8-0"="none"
(minikube) DBG | "SATA-9-0"="none"
(minikube) DBG | "SATA-10-0"="none"
(minikube) DBG | "SATA-11-0"="none"
(minikube) DBG | "SATA-12-0"="none"
(minikube) DBG | "SATA-13-0"="none"
(minikube) DBG | "SATA-14-0"="none"
(minikube) DBG | "SATA-15-0"="none"
(minikube) DBG | "SATA-16-0"="none"
(minikube) DBG | "SATA-17-0"="none"
(minikube) DBG | "SATA-18-0"="none"
(minikube) DBG | "SATA-19-0"="none"
(minikube) DBG | "SATA-20-0"="none"
(minikube) DBG | "SATA-21-0"="none"
(minikube) DBG | "SATA-22-0"="none"
(minikube) DBG | "SATA-23-0"="none"
(minikube) DBG | "SATA-24-0"="none"
(minikube) DBG | "SATA-25-0"="none"
(minikube) DBG | "SATA-26-0"="none"
(minikube) DBG | "SATA-27-0"="none"
(minikube) DBG | "SATA-28-0"="none"
(minikube) DBG | "SATA-29-0"="none"
(minikube) DBG | natnet1="nat"
(minikube) DBG | macaddress1="0800276B97F7"
(minikube) DBG | cableconnected1="on"
(minikube) DBG | nic1="nat"
(minikube) DBG | nictype1="82540EM"
(minikube) DBG | nicspeed1="0"
(minikube) DBG | mtu="0"
(minikube) DBG | sockSnd="64"
(minikube) DBG | sockRcv="64"
(minikube) DBG | tcpWndSnd="64"
(minikube) DBG | tcpWndRcv="64"
(minikube) DBG | Forwarding(0)="ssh,tcp,127.0.0.1,53964,,22"
(minikube) DBG | hostonlyadapter2="vboxnet1"
(minikube) DBG | macaddress2="08002721BF68"
(minikube) DBG | cableconnected2="on"
(minikube) DBG | nic2="hostonly"
(minikube) DBG | nictype2="82540EM"
(minikube) DBG | nicspeed2="0"
(minikube) DBG | nic3="none"
(minikube) DBG | nic4="none"
(minikube) DBG | nic5="none"
(minikube) DBG | nic6="none"
(minikube) DBG | nic7="none"
(minikube) DBG | nic8="none"
(minikube) DBG | hidpointing="ps2mouse"
(minikube) DBG | hidkeyboard="ps2kbd"
(minikube) DBG | uart1="off"
(minikube) DBG | uart2="off"
(minikube) DBG | uart3="off"
(minikube) DBG | uart4="off"
(minikube) DBG | lpt1="off"
(minikube) DBG | lpt2="off"
(minikube) DBG | audio="coreaudio"
(minikube) DBG | clipboard="disabled"
(minikube) DBG | draganddrop="disabled"
(minikube) DBG | SessionName="headless"
(minikube) DBG | VideoMode="720,400,0"@0,0 1
(minikube) DBG | vrde="off"
(minikube) DBG | usb="off"
(minikube) DBG | ehci="off"
(minikube) DBG | xhci="off"
(minikube) DBG | SharedFolderNameMachineMapping1="Users"
(minikube) DBG | SharedFolderPathMachineMapping1="/Users"
(minikube) DBG | VRDEActiveConnection="off"
(minikube) DBG | VRDEClients=0
(minikube) DBG | vcpenabled="off"
(minikube) DBG | vcpscreens=0
(minikube) DBG | vcpfile="/Users/namedev/.minikube/machines/minikube/minikube/minikube.webm"
(minikube) DBG | vcpwidth=1024
(minikube) DBG | vcpheight=768
(minikube) DBG | vcprate=512
(minikube) DBG | vcpfps=25
(minikube) DBG | GuestMemoryBalloon=0
(minikube) DBG | GuestOSType="Linux26_64"
(minikube) DBG | GuestAdditionsRunLevel=2
(minikube) DBG | GuestAdditionsVersion="5.1.6 r110634"
(minikube) DBG | GuestAdditionsFacility_VirtualBox Base Driver=50,1488327525999
(minikube) DBG | GuestAdditionsFacility_VirtualBox System Service=50,1488327526490
(minikube) DBG | GuestAdditionsFacility_Seamless Mode=0,1488327525997
(minikube) DBG | GuestAdditionsFacility_Graphics Mode=0,1488327525997
(minikube) DBG | }
(minikube) DBG | STDERR:
(minikube) DBG | {
(minikube) DBG | }
(minikube) DBG | Host-only MAC: 08002721bf68
(minikube) DBG | 
(minikube) DBG | Using SSH client type: external
(minikube) DBG | Using SSH private key: /Users/namedev/.minikube/machines/minikube/id_rsa (-rw-------)
(minikube) DBG | &{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker@127.0.0.1 -o IdentitiesOnly=yes -i /Users/namedev/.minikube/machines/minikube/id_rsa -p 53964] /usr/bin/ssh <nil>}
(minikube) DBG | About to run SSH command:
(minikube) DBG | ip addr show
(minikube) DBG | SSH cmd err, output: <nil>: 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
(minikube) DBG |     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
(minikube) DBG |     inet 127.0.0.1/8 scope host lo
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG |     inet6 ::1/128 scope host 
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG | 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
(minikube) DBG |     link/ether 08:00:27:6b:97:f7 brd ff:ff:ff:ff:ff:ff
(minikube) DBG |     inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
(minikube) DBG |        valid_lft 82347sec preferred_lft 82347sec
(minikube) DBG |     inet6 fe80::a00:27ff:fe6b:97f7/64 scope link 
(minikube) DBG |        valid_lft forever preferred_lft forever
192.168.99.102
Making call to close driver server
(minikube) Calling .Close
(minikube) DBG | 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
(minikube) DBG |     link/ether 08:00:27:21:bf:68 brd ff:ff:ff:ff:ff:ff
(minikube) DBG |     inet 192.168.99.102/24 brd 192.168.99.255 scope global dynamic eth1
(minikube) DBG |        valid_lft 1194sec preferred_lft 1194sec
(minikube) DBG |     inet6 fe80::a00:27ff:fe21:bf68/64 scope link 
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG | 4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1
(minikube) DBG |     link/sit 0.0.0.0 brd 0.0.0.0
(minikube) DBG | 6: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
(minikube) DBG |     link/ether 02:42:f6:89:ce:77 brd ff:ff:ff:ff:ff:ff
(minikube) DBG |     inet 172.17.0.1/16 scope global docker0
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG |     inet6 fe80::42:f6ff:fe89:ce77/64 scope link 
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG | 8: vetha3e3212@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
(minikube) DBG |     link/ether a2:f2:25:6e:36:4d brd ff:ff:ff:ff:ff:ff link-netnsid 0
(minikube) DBG |     inet6 fe80::a0f2:25ff:fe6e:364d/64 scope link 
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG | 10: veth5a5eea5@if9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
(minikube) DBG |     link/ether 26:6e:b4:68:46:80 brd ff:ff:ff:ff:ff:ff link-netnsid 1
(minikube) DBG |     inet6 fe80::246e:b4ff:fe68:4680/64 scope link 
(minikube) DBG |        valid_lft forever preferred_lft forever
(minikube) DBG | 12: veth784d436@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
(minikube) DBG |     link/ether ca:46:10:26:92:a7 brd ff:ff:ff:ff:ff:ff link-netnsid 2
(minikube) DBG |     inet6 fe80::c846:10ff:fe26:92a7/64 scope link 
(minikube) DBG |        valid_lft forever preferred_lft forever
Successfully made call to close driver server
Making call to close connection to plugin binary
(minikube) DBG | 14: veth48a4207@if13: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 

我已经确认 Plugin server listening at address 127.0.0.1:59573每次minikube ip调用此行的端口号都会更改

如果我切换到 xhyve 驱动程序,一切都会很好。

我正在运行
macOS
10.12.3 virtualbox 5.1.4 r110228
节点 7.5.0

4

1 回答 1

0

我找到了答案。显然 VBoxManage 对它使用的用户很挑剔。我能够让它工作sudo -u USERNAME minikube ip

exec('sudo -u USERNAME minikube ip', (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
});
于 2017-03-01T17:10:08.140 回答