const path = require('path') const fs = require('fs/promises') const cp = require('child_process') let d1 = fs.rm(path.join(__dirname, 'node_modules', '_plglib@0.0.69@plglib'), { force: true, recursive: true, }) let d2 = fs.rm(path.join(__dirname, 'node_modules', 'plglib'), { force: true, recursive: true, }) Promise.all([d1, d2]).then(err => { if (err[0] || err[1]) { console.log('删除文件失败') return; } cp.exec('plgnpm i', err => { }); });