const {spawn} = require('child_process'); const cmd = "cd public_html && npm install"; const p = spawn(cmd, [], {shell: true}); p.stdout.on("data", (data) => { console.log(data.toString()); });