I want to execute npm run build, in the specified directory through an API written by node, but the result reports an error. The reason is the directory where the npm run build is executed or the directory where the file is located. How to achieve the desired results?
process.exec("cd ", function (error, stdout, stderr) {
process.exec("npm run build", function(error, stdout, stderr) {
});
})