0

I need to execute a command line operation from nodejs program. But I don't want to open console. I need to get result back to a variable. sync-exec module is helping to get result back but it keeps open a console for process execution.

I am sharing small bit of code.

       var execSync = require('sync-exec');
       var npmGlobalPath = execSync('npm config get prefix');
       console.log(npmGlobalPath);

one more thing I want to share. This was happening when I already spawned a child process from parent. Now this code is in child process.

0 Answers0