Is it possible to start a Virtual Box VM from a web application?
I have a Virtual Machine with ubuntu installed, on Windows as host. I have an Angular (4) app, from which I want to start a VM. The point is, to start the Virtual Machine before the web application in Windows (both the Angular app and the VM run in Windows as host).
To start the VM from command line, I normally use something like:
C:/Program Files/Oracle/VirtualBox/VBoxManage.exe' startvm virtualMachineName
So I thought that using the same line in package json, would work:
"ng": "ng",
"start": "ng serve",
"startBackend": "'C:/Program Files/Oracle/VirtualBox/VBoxManage.exe' startvm virtualMachineName",
....
"build": "startBackend && ng build --prod",
I tried to scape the backslasches, because I'm on windows.
"startBackend": "'C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe' startvm virtualMachineName",
but also didn't work.
Is this possible at all? Are there any other options?
I currently run something like
npm run electron-build
where I combined ng build with a script to start electron, as my app works in electron. Should I then start the VM directly with npm? How can I do that ?
The code provided by @Zlatko works perfectly, but now I have another question.
The node-virtualbox library works of course only for VirtualBox VM , but what about other type of VM, like VMware ?
So far, I tried node-vmrun, but I always get:
vm run not found or false