Node-Virtualization / node-virtualbox

A JavaScript Library for Interacting with VirtualBox
MIT License
259 stars 68 forks source link

Error: spawn "C:\Program Files\Oracle\VirtualBox\\VBoxManage.exe" ENOENT #95

Closed csmit195 closed 4 years ago

csmit195 commented 4 years ago

Hi, been looking for a useful library, this seems to be the only one with the capability to check if a VM is running. Just need to figure out why this is happening and how I can pass through it. I'm available for testing via discord, csmit195#2008. Thanks :-)

Operating System: Windows 10

Description: Won't work with any of my VM's, state returns false for running and non running ones. and err is thrown.

Code:

const virtualbox = require('virtualbox');

const VMName = 'OpenFlixr';

virtualbox.isRunning(VMName, function(err, state){
    if (err) throw err;
    console.log(state);
});

Terminal Output:

PS C:\Users\Chris\Desktop\Projects\AutoVMStartShutdown> node index.js
[2020-08-21 15:10:49.212] [INFO] VirtualBox - win32
[2020-08-21 15:10:49.220] [INFO] VirtualBox - Virtualbox version detected as 
[2020-08-21 15:10:49.221] [INFO] VirtualBox - Checking virtual machine "OpenFlixr" is running or not
Error: spawn "C:\Program Files\Oracle\VirtualBox\\VBoxManage.exe"  ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn "C:\\Program Files\\Oracle\\VirtualBox\\\\VBoxManage.exe" ',
  path: '"C:\\Program Files\\Oracle\\VirtualBox\\\\VBoxManage.exe" ',
  spawnargs: [ 'list', 'runningvms' ],
  cmd: '"C:\\Program Files\\Oracle\\VirtualBox\\\\VBoxManage.exe"  list runningvms'
}
colonelpopcorn commented 4 years ago

Hi, I was able to reproduce on my system. The issue was with how we formed our path to virtualbox. I've got a PR up that should fix this. Stay tuned for v1.1.1 release to fix this.

colonelpopcorn commented 4 years ago

I just released v1.1.1 to NPM. @csmit195 Would you try installing the new version and see if this is fixed?

csmit195 commented 4 years ago

@colonelpopcorn works perfectly :-) thank you.