I wrote an app with Electron js that encapsulate Ionic apps for editing them live.
So i use a child process to cd {ionic app path} && ionic serve
/npm install
/npm update
for serving and updating packages of the live Ionic app in my Electron container.
No problems with this technique on my side. But when i package my app and use an installer to test it on a clean machine, npm cannot be executed because of nodejs that is not installed on it.
First I was thinking of including a nodejs installer into my main app installer but this does not seem to me that is the good way of doing it.
And after digging on stackoverflow I've found this thread: Install programmatically a NPM package providing its version
that explain how to use npm directly in my code with require("npm");
and that's worked but i was not able to tell npm.install()
in which folder i want to run this command what was possible with child process.
I has tried to read the lib but this not seams to be possible: https://github.com/npm/npm/blob/latest/lib/install.js
Do you have any idea what I can do to solve this problem ?