var npm = require("npm"); var open = require("open"); npm.load(function(err) { npm.commands.run(['webpack-dev-server'], function(er, data) { // log errors or data if (er){ console.error(er); } }); open("http://localhost:8080"); npm.on('log', function(message) { // log installation progress console.log(message); }); });