问题
I'm spawning npm install -g create-react-app
from a js
script. I want to know if it's possible to get the progress of the installation using spawn
.
const npmExecutable = /^win/.test(process.platform) ? "npm.cmd" : "npm";
const npm = spawn(npmExecutable, ["install", "-g", "create-react-app"]);
I have read this question about using:
npm.on("message", data => {
console.log(`A message: ${data}`);
});
but it does not show anything.
There is a related question, about knowing the progress of a python
script, but it does not have any answers.
Does someone of you have tried something like that or know any clue about this?
来源:https://stackoverflow.com/questions/55286601/it-is-possible-to-get-the-progress-of-a-spawned-process-from-nodejs